📄 intermediate
字号:
# -*-perl-*-$description = "Test the behaviour of the .INTERMEDIATE target.";$details = "\Test the behavior of the .INTERMEDIATE special target.Create a makefile where a file would not normally be consideredintermediate, then specify it as .INTERMEDIATE. Build and ensure it'sdeleted properly. Rebuild to ensure that it's not created if it doesn'texist but doesn't need to be built. Change the original and ensurethat the intermediate file and the ultimate target are both rebuilt, andthat the intermediate file is again deleted.Try this with implicit rules and explicit rules: both should work.\n";open(MAKEFILE,"> $makefile");print MAKEFILE <<'EOF';.INTERMEDIATE: foo.e bar.e# Implicit rule test%.d : %.e ; cp $< $@%.e : %.f ; cp $< $@foo.d: foo.e# Explicit rule testfoo.c: foo.e bar.e; cat $^ > $@EOFclose(MAKEFILE);# TEST #0&utouch(-20, 'foo.f', 'bar.f');&run_make_with_options($makefile,'foo.d',&get_logfile);$answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";&compare_output($answer, &get_logfile(1));# TEST #1&run_make_with_options($makefile,'foo.d',&get_logfile);$answer = "$make_name: `foo.d' is up to date.\n";&compare_output($answer, &get_logfile(1));# TEST #2&utouch(-10, 'foo.d');&touch('foo.f');&run_make_with_options($makefile,'foo.d',&get_logfile);$answer = "cp foo.f foo.e\ncp foo.e foo.d\nrm foo.e\n";&compare_output($answer, &get_logfile(1));# TEST #3&run_make_with_options($makefile,'foo.c',&get_logfile);$answer = "cp foo.f foo.e\ncp bar.f bar.e\ncat foo.e bar.e > foo.c\nrm bar.e foo.e\n";&compare_output($answer, &get_logfile(1));# TEST #4&run_make_with_options($makefile,'foo.c',&get_logfile);$answer = "$make_name: `foo.c' is up to date.\n";&compare_output($answer, &get_logfile(1));# TEST #5&utouch(-10, 'foo.c');&touch('foo.f');&run_make_with_options($makefile,'foo.c',&get_logfile);$answer = "cp foo.f foo.e\ncp bar.f bar.e\ncat foo.e bar.e > foo.c\nrm bar.e foo.e\n";&compare_output($answer, &get_logfile(1));# TEST #6 -- added for PR/1669: don't remove files mentioned on the cmd line.&run_make_with_options($makefile,'foo.e',&get_logfile);$answer = "cp foo.f foo.e\n";&compare_output($answer, &get_logfile(1));unlink('foo.f', 'foo.e', 'foo.d', 'foo.c', 'bar.f', 'bar.e', 'bar.d', 'bar.c');# TEST #7 -- added for PR/1423$makefile2 = &get_tmpfile;open(MAKEFILE, "> $makefile2");print MAKEFILE <<'EOF';all: foofoo.a: ; touch $@%: %.a ; touch $@.INTERMEDIATE: foo.aEOFclose(MAKEFILE);&run_make_with_options($makefile2, '-R', &get_logfile);$answer = "touch foo.a\ntouch foo\nrm foo.a\n";&compare_output($answer, &get_logfile(1));unlink('foo');# This tells the test driver that the perl test script executed properly.1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -