2005-02-27 22:24:30 +00:00
|
|
|
# -*-perl-*-
|
2005-05-03 13:57:20 +00:00
|
|
|
$description = "Test the .DEFAULT_GOAL special variable.";
|
2005-02-27 22:24:30 +00:00
|
|
|
|
|
|
|
$details = "";
|
|
|
|
|
2005-03-09 19:21:34 +00:00
|
|
|
|
2005-02-27 22:24:30 +00:00
|
|
|
# Test #1: basic logic.
|
|
|
|
#
|
|
|
|
run_make_test('
|
|
|
|
# Basics.
|
|
|
|
#
|
|
|
|
foo: ; @:
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
ifneq ($(.DEFAULT_GOAL),foo)
|
2005-02-27 22:24:30 +00:00
|
|
|
$(error )
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Reset to empty.
|
|
|
|
#
|
2005-05-03 13:57:20 +00:00
|
|
|
.DEFAULT_GOAL :=
|
2005-02-27 22:24:30 +00:00
|
|
|
|
|
|
|
bar: ; @:
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
ifneq ($(.DEFAULT_GOAL),bar)
|
2005-02-27 22:24:30 +00:00
|
|
|
$(error )
|
|
|
|
endif
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
# Change to a different goal.
|
2005-02-27 22:24:30 +00:00
|
|
|
#
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
.DEFAULT_GOAL := baz
|
2005-02-27 22:24:30 +00:00
|
|
|
|
|
|
|
baz: ; @echo $@
|
|
|
|
',
|
|
|
|
'',
|
|
|
|
'baz');
|
|
|
|
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
# Test #2: unknown goal.
|
2005-02-27 22:24:30 +00:00
|
|
|
#
|
|
|
|
run_make_test('
|
2005-05-03 13:57:20 +00:00
|
|
|
.DEFAULT_GOAL = foo
|
2005-02-27 22:24:30 +00:00
|
|
|
',
|
|
|
|
'',
|
2012-03-04 00:24:20 +00:00
|
|
|
"#MAKE#: *** No rule to make target 'foo'. Stop.",
|
2005-02-27 22:24:30 +00:00
|
|
|
512);
|
|
|
|
|
|
|
|
|
2005-05-03 13:57:20 +00:00
|
|
|
# Test #3: more than one goal.
|
2005-02-27 22:24:30 +00:00
|
|
|
#
|
|
|
|
run_make_test('
|
2005-05-03 13:57:20 +00:00
|
|
|
.DEFAULT_GOAL := foo bar
|
2005-02-27 22:24:30 +00:00
|
|
|
',
|
|
|
|
'',
|
2005-05-03 13:57:20 +00:00
|
|
|
'#MAKE#: *** .DEFAULT_GOAL contains more than one target. Stop.',
|
2005-02-27 22:24:30 +00:00
|
|
|
512);
|
|
|
|
|
|
|
|
|
2005-03-09 19:21:34 +00:00
|
|
|
# Test #4: Savannah bug #12226.
|
|
|
|
#
|
|
|
|
run_make_test('
|
|
|
|
define rule
|
|
|
|
foo: ; @echo $$@
|
|
|
|
endef
|
|
|
|
|
|
|
|
define make-rule
|
|
|
|
$(eval $(rule))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(call make-rule)
|
|
|
|
|
|
|
|
',
|
|
|
|
'',
|
|
|
|
'foo');
|
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
# TEST #5: .DEFAULT_GOAL containing just whitespace (Savannah bug #25697)
|
|
|
|
|
|
|
|
run_make_test('
|
|
|
|
N =
|
|
|
|
.DEFAULT_GOAL = $N $N # Just whitespace
|
|
|
|
|
|
|
|
foo: ; @echo "boo"
|
|
|
|
',
|
|
|
|
'', "#MAKE#: *** No targets. Stop.\n", 512);
|
2005-03-09 19:21:34 +00:00
|
|
|
|
2005-02-27 22:24:30 +00:00
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|