📄 order_only
字号:
# -*-perl-*-$description = "Test order-only prerequisites.";$details = "\Create makefiles with various combinations of normal and order-onlyprerequisites and ensure they behave properly. Test the \$| variable.";open(MAKEFILE,"> $makefile");print MAKEFILE <<'EOF';foo: bar | baz @echo '$$^ = $^' @echo '$$| = $|' touch $@.PHONY: bazbar baz: touch $@EOFclose(MAKEFILE);# TEST #1 -- just the syntax&run_make_with_options($makefile, "", &get_logfile);$answer = "touch bar\ntouch baz\n\$^ = bar\n\$| = baz\ntouch foo\n";&compare_output($answer,&get_logfile(1));# TEST #2 -- now we do it again: baz is PHONY but foo should _NOT_ be updated&run_make_with_options($makefile, "", &get_logfile);$answer = "touch baz\n";&compare_output($answer,&get_logfile(1));unlink(qw(foo bar baz));# Test prereqs that are both order and non-order$makefile2 = &get_tmpfile;open(MAKEFILE,"> $makefile2");print MAKEFILE <<'EOF';foo: bar | baz @echo '$$^ = $^' @echo '$$| = $|' touch $@foo: baz.PHONY: bazbar baz: touch $@EOFclose(MAKEFILE);# TEST #3 -- Make sure the order-only prereq was promoted to normal.&run_make_with_options($makefile2, "", &get_logfile);$answer = "touch bar\ntouch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";&compare_output($answer,&get_logfile(1));# TEST #4 -- now we do it again&run_make_with_options($makefile2, "", &get_logfile);$answer = "touch baz\n\$^ = bar baz\n\$| = \ntouch foo\n";&compare_output($answer,&get_logfile(1));unlink(qw(foo bar baz));# Test empty normal prereqs$makefile3 = &get_tmpfile;open(MAKEFILE,"> $makefile3");print MAKEFILE <<'EOF';foo:| baz @echo '$$^ = $^' @echo '$$| = $|' touch $@.PHONY: bazbaz: touch $@EOFclose(MAKEFILE);# TEST #5 -- make sure the parser was correct.&run_make_with_options($makefile3, "", &get_logfile);$answer = "touch baz\n\$^ = \n\$| = baz\ntouch foo\n";&compare_output($answer,&get_logfile(1));# TEST #6 -- now we do it again: this time foo won't be built&run_make_with_options($makefile3, "", &get_logfile);$answer = "touch baz\n";&compare_output($answer,&get_logfile(1));unlink(qw(foo baz));1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -