2002-09-04 07:26:19 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "\
|
|
|
|
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.";
|
|
|
|
|
2005-10-24 13:01:39 +00:00
|
|
|
run_make_test('
|
2002-09-04 07:26:19 +00:00
|
|
|
# Make sure that subdirectories built as prerequisites are actually handled
|
|
|
|
# properly.
|
|
|
|
|
|
|
|
all: dir/subdir/file.a
|
|
|
|
|
|
|
|
dir/subdir: ; @echo mkdir -p dir/subdir
|
|
|
|
|
|
|
|
dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
|
|
|
|
|
2005-10-24 13:01:39 +00:00
|
|
|
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");
|
2002-09-04 07:26:19 +00:00
|
|
|
|
2005-02-27 21:40:23 +00:00
|
|
|
# Test implicit rules
|
|
|
|
|
|
|
|
&touch('foo.c');
|
2005-02-28 07:48:22 +00:00
|
|
|
run_make_test('foo: foo.o',
|
2005-02-27 21:40:23 +00:00
|
|
|
'CC="@echo cc" OUTPUT_OPTION=',
|
|
|
|
'cc -c foo.c
|
|
|
|
cc foo.o -o foo');
|
|
|
|
unlink('foo.c');
|
|
|
|
|
|
|
|
|
2005-10-24 13:01:39 +00:00
|
|
|
# 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:
|
2005-10-26 16:06:30 +00:00
|
|
|
baz$$bar bar$$baz: ; @echo '$@'
|
2005-10-24 13:01:39 +00:00
|
|
|
!,
|
|
|
|
'',
|
2005-10-26 16:06:30 +00:00
|
|
|
"baz\$bar\ndone baz\$bar");
|
2005-10-24 13:01:39 +00:00
|
|
|
|
2005-12-11 15:41:17 +00:00
|
|
|
|
|
|
|
# Test implicit rules with '$' in the name (see se_implicit)
|
|
|
|
# Use the '$' in the pattern.
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
%.foo : %$$bar ; @echo 'done $<'
|
|
|
|
test.foo:
|
|
|
|
test$$bar: ; @echo '$@'
|
|
|
|
!,
|
|
|
|
'',
|
|
|
|
"test\$bar\ndone test\$bar");
|
|
|
|
|
|
|
|
# Make sure that subdirectories built as prerequisites are actually handled
|
|
|
|
# properly... this time with '$'
|
|
|
|
|
|
|
|
run_make_test(q!
|
|
|
|
|
|
|
|
all: dir/subdir/file.$$a
|
|
|
|
|
|
|
|
dir/subdir: ; @echo mkdir -p '$@'
|
|
|
|
|
|
|
|
dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
2009-06-05 01:17:29 +00:00
|
|
|
# Test odd whitespace at the beginning of a line
|
|
|
|
|
|
|
|
run_make_test("
|
|
|
|
all:
|
|
|
|
\f
|
|
|
|
|
|
|
|
\\
|
|
|
|
\f \\
|
|
|
|
\013 \\
|
|
|
|
all: ; \@echo hi
|
|
|
|
",
|
|
|
|
'', "hi\n");
|
|
|
|
|
2019-09-07 02:24:46 +00:00
|
|
|
# SV-56834 Ensure setting PATH in the makefile works properly
|
2019-09-15 20:39:22 +00:00
|
|
|
my $sname = "foobar$scriptsuffix";
|
|
|
|
|
2019-09-07 02:24:46 +00:00
|
|
|
mkdir('sd', 0775);
|
2019-09-15 20:39:22 +00:00
|
|
|
create_file("sd/$sname", "exit 0\n");
|
|
|
|
chmod 0755, "sd/$sname";
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
run_make_test(qq!
|
2019-09-07 02:24:46 +00:00
|
|
|
PATH := sd
|
2019-09-15 20:39:22 +00:00
|
|
|
all: ; $sname >/dev/null
|
2019-09-07 02:24:46 +00:00
|
|
|
!,
|
2019-09-15 20:39:22 +00:00
|
|
|
'', "$sname >/dev/null\n");
|
2019-09-07 02:24:46 +00:00
|
|
|
|
|
|
|
# Don't use the general PATH if not found on the target path
|
|
|
|
|
2020-04-01 05:58:33 +00:00
|
|
|
$ENV{PATH} = "$ENV{PATH}:sd";
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
run_make_test(qq!
|
2019-09-07 02:24:46 +00:00
|
|
|
PATH := ..
|
2019-09-15 20:39:22 +00:00
|
|
|
all: ; $sname
|
2019-09-07 02:24:46 +00:00
|
|
|
!,
|
2019-09-22 21:02:57 +00:00
|
|
|
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
unlink("sd/$sname");
|
2019-09-07 02:24:46 +00:00
|
|
|
rmdir('sd');
|
|
|
|
|
|
|
|
# Ensure that local programs are not found if "." is not on the PATH
|
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
create_file($sname, '');
|
|
|
|
chmod 0755, $sname;
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
run_make_test(qq!
|
2019-09-07 02:24:46 +00:00
|
|
|
PATH := ..
|
2019-09-15 20:39:22 +00:00
|
|
|
all: ; $sname
|
2019-09-07 02:24:46 +00:00
|
|
|
!,
|
2019-09-22 21:02:57 +00:00
|
|
|
'', "$sname\n#MAKE#: $sname: $ERR_no_such_file\n#MAKE#: *** [#MAKEFILE#:3: all] Error 127", 512);
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2019-09-15 20:39:22 +00:00
|
|
|
unlink($sname);
|
2019-09-07 02:24:46 +00:00
|
|
|
|
2020-04-01 05:13:02 +00:00
|
|
|
# SV 57674: ensure we use a system default PATH if one is not set
|
|
|
|
delete $ENV{PATH};
|
|
|
|
run_make_test(q!
|
|
|
|
a: ; @echo hi
|
|
|
|
!,
|
|
|
|
'', "hi\n");
|
|
|
|
|
2002-09-04 07:26:19 +00:00
|
|
|
1;
|