mirror of
https://github.com/mirror/make.git
synced 2025-01-14 14:20:20 +08:00
6164608900
Fix .NOTINTERMEDIATE without prerequisites to disable intermediate status for all targets. * src/makeint.h: Declare extern no_intermediates. * src/main.c: Add global definition of no_intermediates. * src/file.c: Remove static no_intermediates to use global variable. (remove_intermediates): Check no_intermediates. * src/implicit.c (pattern_search): For a file found by implicit search set file->notintermediate if no_intermediates is set. * src/remake.c (update_file_1): Don't set file->secondary for a pre-existing file if no_intermediates is set. The check for no_intermediates here is redundant, but won't hurt: keep it in case things change so that it matters. * tests/scripts/targets/NOTINTERMEDIATE: Fix a test.
117 lines
2.8 KiB
Perl
117 lines
2.8 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test the behaviour of the .NOTINTERMEDIATE target.";
|
|
|
|
$details = "\
|
|
Test the behavior of the .NOTINTERMEDIATE special target.\n";
|
|
|
|
touch('hello.z');
|
|
unlink('hello.x');
|
|
|
|
|
|
# Test 1. A file which matches a .NOTINTERMEDIATE pattern is not intermediate.
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE: %.q %.x
|
|
!, '', "touch hello.z\n");
|
|
|
|
# Test 2. .NOTINTERMEDIATE: %.q pattern has no effect on hello.x.
|
|
touch('hello.z');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE: %.q
|
|
!, '', "#MAKE#: 'hello.z' is up to date.\n");
|
|
|
|
# Test 3. A file which is a prereq of .NOTINTERMEDIATE is not intermediate.
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE: %.q hello.x
|
|
!, '', "touch hello.z\n");
|
|
|
|
# Test 4. .NOTINTERMEDIATE without prerequisites makes everything
|
|
# notintermediate.
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE:
|
|
!, '', "touch hello.z\n");
|
|
|
|
# Test 5. Same file cannot be intermediate and notintermediate.
|
|
run_make_test(q!
|
|
.INTERMEDIATE: hello.x
|
|
.NOTINTERMEDIATE: hello.x
|
|
!, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .INTERMEDIATE. Stop.\n", 512);
|
|
|
|
# Test 6. Same file cannot be secondary and notintermediate.
|
|
run_make_test(q!
|
|
.SECONDARY: hello.x
|
|
.NOTINTERMEDIATE: hello.x
|
|
!, '', "#MAKE#: *** hello.x cannot be both .NOTINTERMEDIATE and .SECONDARY. Stop.\n", 512);
|
|
|
|
# Test 7. All .SECONDARY and all .NOTINTERMEDIATE are mutually exclusive.
|
|
run_make_test(q!
|
|
.SECONDARY:
|
|
.NOTINTERMEDIATE:
|
|
!, '', "#MAKE#: *** .NOTINTERMEDIATE and .SECONDARY are mutually exclusive. Stop.\n", 512);
|
|
|
|
# Test 8. .INTERMEDIATE file takes priority over a .NOTINTERMEDIATE pattern.
|
|
unlink('hello.x');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.INTERMEDIATE: hello.x
|
|
.NOTINTERMEDIATE: %.q %.x
|
|
!, '', "#MAKE#: 'hello.z' is up to date.\n");
|
|
|
|
# Test 9. Everything is notintermediate, except hello.x.
|
|
unlink('hello.x');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.INTERMEDIATE: hello.x
|
|
.NOTINTERMEDIATE:
|
|
!, '', "#MAKE#: 'hello.z' is up to date.\n");
|
|
|
|
# Test 10. Everything is notintermediate, except hello.x.
|
|
unlink('hello.x');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.SECONDARY: hello.x
|
|
.NOTINTERMEDIATE:
|
|
!, '', "#MAKE#: 'hello.z' is up to date.\n");
|
|
|
|
# Test 11. Everything is secondary, except %.q, hello.x.
|
|
unlink('hello.x');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE: %.q hello.x
|
|
.SECONDARY:
|
|
!, '', "touch hello.z\n");
|
|
|
|
# Test 12. Everything is secondary, except %.q %.x.
|
|
unlink('hello.x');
|
|
run_make_test(q!
|
|
hello.z:
|
|
%.z: %.x; touch $@
|
|
%.x: ;
|
|
.NOTINTERMEDIATE: %.q %.x
|
|
.SECONDARY:
|
|
!, '', "touch hello.z\n");
|
|
|
|
unlink('hello.z');
|
|
# This tells the test driver that the perl test script executed properly.
|
|
1;
|