From 11095a90f120545c915c92b8ebf48f04723d1837 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Mon, 24 Oct 2005 13:01:39 +0000 Subject: Make second expansion optional (partial implementation). I decided this feature was too impacting to make the permanent default behavior. This set of changes makes the default behavior of make the old behavior (no second expansion). If you want second expansion, you must define the .SECONDEXPANSION: special target before the first target that needs it. This set of changes ONLY fixes explicit and static pattern rules to work like this. Implicit rules still have second expansion enabled all the time: I'll work on that next. Note that there is still a backward-incompatibility: now to get the old SysV behavior using $$@ etc. in the prerequisites list you need to set .SECONDEXPANSION: as well. --- tests/scripts/misc/general4 | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'tests/scripts/misc') diff --git a/tests/scripts/misc/general4 b/tests/scripts/misc/general4 index 63320e2..0b5c94a 100644 --- a/tests/scripts/misc/general4 +++ b/tests/scripts/misc/general4 @@ -5,8 +5,7 @@ This tests random features of make's algorithms, often somewhat obscure, which have either broken at some point in the past or seem likely to break."; -open(MAKEFILE,"> $makefile"); -print MAKEFILE <<'EOF'; +run_make_test(' # Make sure that subdirectories built as prerequisites are actually handled # properly. @@ -16,13 +15,8 @@ dir/subdir: ; @echo mkdir -p dir/subdir dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b -dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@ -EOF -close(MAKEFILE); - -&run_make_with_options($makefile,"",&get_logfile); -$answer = "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"; -&compare_output($answer,&get_logfile(1)); +dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@', + '', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n"); # Test implicit rules @@ -47,4 +41,17 @@ fox: baz 'done bar'); unlink('bar'); + +# Test implicit rules with '$' in the name (see se_implicit) + +run_make_test(q! +%.foo : baz$$bar ; @echo 'done $<' +%.foo : bar$$baz ; @echo 'done $<' +test.foo: +fox: baz +.DEFAULT baz$$bar bar$$baz: ; @echo '$@' +!, + '', + 'done bar'); + 1; -- cgit v1.2.3