1#                                                                    -*-perl-*-
2$description = "Test the .DEFAULT_GOAL special variable.";
3
4$details = "";
5
6
7# Test #1: basic logic.
8#
9run_make_test('
10# Basics.
11#
12foo: ; @:
13
14ifneq ($(.DEFAULT_GOAL),foo)
15$(error )
16endif
17
18# Reset to empty.
19#
20.DEFAULT_GOAL :=
21
22bar: ; @:
23
24ifneq ($(.DEFAULT_GOAL),bar)
25$(error )
26endif
27
28# Change to a different goal.
29#
30
31.DEFAULT_GOAL := baz
32
33baz: ; @echo $@
34',
35'',
36'baz');
37
38
39# Test #2: unknown goal.
40#
41run_make_test('
42.DEFAULT_GOAL = foo
43',
44'',
45'#MAKE#: *** No rule to make target `foo\'.  Stop.',
46512);
47
48
49# Test #3: more than one goal.
50#
51run_make_test('
52.DEFAULT_GOAL := foo bar
53',
54'',
55'#MAKE#: *** .DEFAULT_GOAL contains more than one target.  Stop.',
56512);
57
58
59# Test #4: Savannah bug #12226.
60#
61run_make_test('
62define rule
63foo: ; @echo $$@
64endef
65
66define make-rule
67$(eval $(rule))
68endef
69
70$(call make-rule)
71
72',
73'',
74'foo');
75
76
77# This tells the test driver that the perl test script executed properly.
781;
79