Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines.
[make.git] / tests / scripts / variables / DEFAULT_GOAL
blob8188ce71cacbdcbdcd937717d03c26af25ef3628
1 #                                                                    -*-perl-*-
2 $description = "Test the .DEFAULT_GOAL special variable.";
4 $details = "";
7 # Test #1: basic logic.
9 run_make_test('
10 # Basics.
12 foo: ; @:
14 ifneq ($(.DEFAULT_GOAL),foo)
15 $(error )
16 endif
18 # Reset to empty.
20 .DEFAULT_GOAL :=
22 bar: ; @:
24 ifneq ($(.DEFAULT_GOAL),bar)
25 $(error )
26 endif
28 # Change to a different goal.
31 .DEFAULT_GOAL := baz
33 baz: ; @echo $@
35 '',
36 'baz');
39 # Test #2: unknown goal.
41 run_make_test('
42 .DEFAULT_GOAL = foo
44 '',
45 "#MAKE#: *** No rule to make target 'foo'.  Stop.",
46 512);
49 # Test #3: more than one goal.
51 run_make_test('
52 .DEFAULT_GOAL := foo bar
54 '',
55 '#MAKE#: *** .DEFAULT_GOAL contains more than one target.  Stop.',
56 512);
59 # Test #4: Savannah bug #12226.
61 run_make_test('
62 define rule
63 foo: ; @echo $$@
64 endef
66 define make-rule
67 $(eval $(rule))
68 endef
70 $(call make-rule)
73 '',
74 'foo');
76 # TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697)
78 run_make_test('
79 N =
80 .DEFAULT_GOAL = $N  $N  # Just whitespace
82 foo: ; @echo "boo"
84               '', "#MAKE#: *** No targets.  Stop.\n", 512);
86 # This tells the test driver that the perl test script executed properly.