| 1 | # -*-perl-*-
|
|---|
| 2 |
|
|---|
| 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.";
|
|---|
| 7 |
|
|---|
| 8 | run_make_test('
|
|---|
| 9 | # Make sure that subdirectories built as prerequisites are actually handled
|
|---|
| 10 | # properly.
|
|---|
| 11 |
|
|---|
| 12 | all: dir/subdir/file.a
|
|---|
| 13 |
|
|---|
| 14 | dir/subdir: ; @echo mkdir -p dir/subdir
|
|---|
| 15 |
|
|---|
| 16 | dir/subdir/file.b: dir/subdir ; @echo touch dir/subdir/file.b
|
|---|
| 17 |
|
|---|
| 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");
|
|---|
| 20 |
|
|---|
| 21 | # Test implicit rules
|
|---|
| 22 | # kmk: No default implicit rules.
|
|---|
| 23 |
|
|---|
| 24 | &touch('foo.c');
|
|---|
| 25 | run_make_test('foo: foo.o',
|
|---|
| 26 | 'CC="@echo cc" OUTPUT_OPTION=',
|
|---|
| 27 | !$is_kmk ? 'cc -c foo.c
|
|---|
| 28 | cc foo.o -o foo' :
|
|---|
| 29 | "#MAKE#: *** No rule to make target `foo.o', needed by `foo'. Stop.",
|
|---|
| 30 | !$is_kmk ? 0 : 512);
|
|---|
| 31 | unlink('foo.c');
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | # Test implicit rules with '$' in the name (see se_implicit)
|
|---|
| 35 |
|
|---|
| 36 | run_make_test(q!
|
|---|
| 37 | %.foo : baz$$bar ; @echo 'done $<'
|
|---|
| 38 | %.foo : bar$$baz ; @echo 'done $<'
|
|---|
| 39 | test.foo:
|
|---|
| 40 | baz$$bar bar$$baz: ; @echo '$@'
|
|---|
| 41 | !,
|
|---|
| 42 | '',
|
|---|
| 43 | "baz\$bar\ndone baz\$bar");
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | # Test implicit rules with '$' in the name (see se_implicit)
|
|---|
| 47 | # Use the '$' in the pattern.
|
|---|
| 48 |
|
|---|
| 49 | run_make_test(q!
|
|---|
| 50 | %.foo : %$$bar ; @echo 'done $<'
|
|---|
| 51 | test.foo:
|
|---|
| 52 | test$$bar: ; @echo '$@'
|
|---|
| 53 | !,
|
|---|
| 54 | '',
|
|---|
| 55 | "test\$bar\ndone test\$bar");
|
|---|
| 56 |
|
|---|
| 57 | # Make sure that subdirectories built as prerequisites are actually handled
|
|---|
| 58 | # properly... this time with '$'
|
|---|
| 59 |
|
|---|
| 60 | run_make_test(q!
|
|---|
| 61 |
|
|---|
| 62 | all: dir/subdir/file.$$a
|
|---|
| 63 |
|
|---|
| 64 | dir/subdir: ; @echo mkdir -p '$@'
|
|---|
| 65 |
|
|---|
| 66 | dir/subdir/file.$$b: dir/subdir ; @echo touch '$@'
|
|---|
| 67 |
|
|---|
| 68 | dir/subdir/%.$$a: dir/subdir/%.$$b ; @echo 'cp $< $@'
|
|---|
| 69 | !,
|
|---|
| 70 | '', "mkdir -p dir/subdir\ntouch dir/subdir/file.\$b\ncp dir/subdir/file.\$b dir/subdir/file.\$a\n");
|
|---|
| 71 |
|
|---|
| 72 | # Test odd whitespace at the beginning of a line
|
|---|
| 73 |
|
|---|
| 74 | run_make_test("
|
|---|
| 75 | all:
|
|---|
| 76 | \f
|
|---|
| 77 |
|
|---|
| 78 | \\
|
|---|
| 79 | \f \\
|
|---|
| 80 | \013 \\
|
|---|
| 81 | all: ; \@echo hi
|
|---|
| 82 | ",
|
|---|
| 83 | '', "hi\n");
|
|---|
| 84 |
|
|---|
| 85 | 1;
|
|---|