4 This tests random features of make's algorithms, often somewhat obscure,
5 which have either broken at some point in the past or seem likely to
9 # Make sure that subdirectories built as prerequisites are actually handled
12 all: dir/subdir/file.a
14 dir/subdir: ; @echo mkdir -p dir/subdir
16 dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
18 dir/subdir/%.a: dir/subdir/%.b ; @echo cp $< $@',
19 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.b\ncp dir/subdir/file.b dir/subdir/file.a\n");
24 run_make_test('foo: foo.o',
25 'CC="@echo cc" OUTPUT_OPTION=',
31 # Test implicit rules with '$' in the name (see se_implicit)
34 %.foo : baz$$bar ; @echo 'done $<'
35 %.foo : bar$$baz ; @echo 'done $<'
37 baz$$bar bar$$baz: ; @echo '$@'
40 "baz\$bar\ndone baz\$bar");
43 # Test implicit rules with '$' in the name (see se_implicit)
44 # Use the '$' in the pattern.
47 %.foo : %$$bar ; @echo 'done $<'
49 test$$bar: ; @echo '$@'
52 "test\$bar\ndone test\$bar");
54 # Make sure that subdirectories built as prerequisites are actually handled
55 # properly... this time with '$'
59 all: dir/subdir/file.$$a
61 dir/subdir: ; @echo mkdir -p '$@'
63 dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
65 dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
67 '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
69 # Test odd whitespace at the beginning of a line
82 # SV-56834 Ensure setting PATH in the makefile works properly
83 my $sname = "foobar$scriptsuffix";
86 create_file("sd/$sname", "exit 0\n");
87 chmod 0755, "sd/$sname";
91 all: ; $sname >/dev/null
93 '', "$sname >/dev/null\n");
95 # Don't use the general PATH if not found on the target path
97 $ENV{PATH} = "$ENV{PATH}:sd";
101 if ($port_type eq 'W32') {
103 $erstr = "process_begin: CreateProcess(NULL, $sname, ...) failed.\nmake (e=2): The system cannot find the file specified.";
106 $erstr = "#MAKE#: $sname: $ERR_no_such_file";
113 '', "$sname\n$erstr\n#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
118 # Ensure that local programs are not found if "." is not on the PATH
120 create_file($sname, '');
123 if ($port_type eq 'W32') {
128 $erstr = "#MAKE#: $sname: $ERR_no_such_file\n";
135 '', "$sname\n$erstr#MAKE#: *** [#MAKEFILE#:3: all] Error $ernum", 512);
139 # SV 57674: ensure we use a system default PATH if one is not set