- Add forgotten variable/define test suite
[make.git] / tests / scripts / misc / general4
blobe67323b9e8755afd0681434f95e62c9277b69273
1 #                                                                    -*-perl-*-
3 $description = "\
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
6 break.";
8 run_make_test('
9 # Make sure that subdirectories built as prerequisites are actually handled
10 # properly.
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");
21 # Test implicit rules
23 &touch('foo.c');
24 run_make_test('foo: foo.o',
25               'CC="@echo cc" OUTPUT_OPTION=',
26               'cc -c foo.c
27 cc foo.o -o foo');
28 unlink('foo.c');
31 # Test other implicit rule searching
33 &touch('bar');
34 run_make_test('
35 test.foo:
36 %.foo : baz ; @echo done $<
37 %.foo : bar ; @echo done $<
38 fox: baz
40               '',
41               'done bar');
42 unlink('bar');
45 # Test implicit rules with '$' in the name (see se_implicit)
47 run_make_test(q!
48 %.foo : baz$$bar ; @echo 'done $<'
49 %.foo : bar$$baz ; @echo 'done $<'
50 test.foo:
51 baz$$bar bar$$baz: ; @echo '$@'
53               '',
54               "baz\$bar\ndone baz\$bar");
57 # Test implicit rules with '$' in the name (see se_implicit)
58 # Use the '$' in the pattern.
60 run_make_test(q!
61 %.foo : %$$bar ; @echo 'done $<'
62 test.foo:
63 test$$bar: ; @echo '$@'
65               '',
66               "test\$bar\ndone test\$bar");
68 # Make sure that subdirectories built as prerequisites are actually handled
69 # properly... this time with '$'
71 run_make_test(q!
73 all: dir/subdir/file.$$a
75 dir/subdir: ; @echo mkdir -p '$@'
77 dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
79 dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
81               '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
83 # Test odd whitespace at the beginning of a line
85 run_make_test("
86 all:
87    \f
89     \\
90  \f  \\
91     \013 \\
92 all: ; \@echo hi
94               '', "hi\n");