Line | |
---|
1 | # -*-perl-*-
|
---|
2 | $description = "Test the .DEFAULT_GOAL special variable.";
|
---|
3 |
|
---|
4 | $details = "";
|
---|
5 |
|
---|
6 |
|
---|
7 | # Test #1: basic logic.
|
---|
8 | #
|
---|
9 | run_make_test('
|
---|
10 | # Basics.
|
---|
11 | #
|
---|
12 | foo: ; @:
|
---|
13 |
|
---|
14 | ifneq ($(.DEFAULT_GOAL),foo)
|
---|
15 | $(error )
|
---|
16 | endif
|
---|
17 |
|
---|
18 | # Reset to empty.
|
---|
19 | #
|
---|
20 | .DEFAULT_GOAL :=
|
---|
21 |
|
---|
22 | bar: ; @:
|
---|
23 |
|
---|
24 | ifneq ($(.DEFAULT_GOAL),bar)
|
---|
25 | $(error )
|
---|
26 | endif
|
---|
27 |
|
---|
28 | # Change to a different goal.
|
---|
29 | #
|
---|
30 |
|
---|
31 | .DEFAULT_GOAL := baz
|
---|
32 |
|
---|
33 | baz: ; @echo $@
|
---|
34 | ',
|
---|
35 | '',
|
---|
36 | 'baz');
|
---|
37 |
|
---|
38 |
|
---|
39 | # Test #2: unknown goal.
|
---|
40 | #
|
---|
41 | run_make_test('
|
---|
42 | .DEFAULT_GOAL = foo
|
---|
43 | ',
|
---|
44 | '',
|
---|
45 | "#MAKE#: *** No rule to make target 'foo'. Stop.",
|
---|
46 | 512);
|
---|
47 |
|
---|
48 |
|
---|
49 | # Test #3: more than one goal.
|
---|
50 | #
|
---|
51 | run_make_test('
|
---|
52 | .DEFAULT_GOAL := foo bar
|
---|
53 | ',
|
---|
54 | '',
|
---|
55 | '#MAKE#: *** .DEFAULT_GOAL contains more than one target. Stop.',
|
---|
56 | 512);
|
---|
57 |
|
---|
58 |
|
---|
59 | # Test #4: Savannah bug #12226.
|
---|
60 | #
|
---|
61 | run_make_test('
|
---|
62 | define rule
|
---|
63 | foo: ; @echo $$@
|
---|
64 | endef
|
---|
65 |
|
---|
66 | define make-rule
|
---|
67 | $(eval $(rule))
|
---|
68 | endef
|
---|
69 |
|
---|
70 | $(call make-rule)
|
---|
71 |
|
---|
72 | ',
|
---|
73 | '',
|
---|
74 | 'foo');
|
---|
75 |
|
---|
76 | # TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697)
|
---|
77 |
|
---|
78 | run_make_test('
|
---|
79 | N =
|
---|
80 | .DEFAULT_GOAL = $N $N # Just whitespace
|
---|
81 |
|
---|
82 | foo: ; @echo "boo"
|
---|
83 | ',
|
---|
84 | '', "#MAKE#: *** No targets. Stop.\n", 512);
|
---|
85 |
|
---|
86 | # This tells the test driver that the perl test script executed properly.
|
---|
87 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.