2009-06-04 06:30:27 +00:00
|
|
|
# -*-perl-*-
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
$description = "Test the override directive on variable assignments.";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
$details = "";
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
# TEST 0: Basic override
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
run_make_test('
|
|
|
|
X = start
|
|
|
|
override recur = $(X)
|
|
|
|
override simple := $(X)
|
|
|
|
X = end
|
|
|
|
all: ; @echo "$(recur) $(simple)"
|
|
|
|
',
|
|
|
|
'recur=I simple=J', "end start\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
# TEST 1: Override with append
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
run_make_test('
|
|
|
|
X += X1
|
|
|
|
override X += X2
|
|
|
|
override Y += Y1
|
|
|
|
Y += Y2
|
|
|
|
all: ; @echo "$(X) $(Y)"
|
|
|
|
',
|
|
|
|
'', "X1 X2 Y1\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
# TEST 2: Override with append to the command line
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
run_make_test(undef, 'X=C Y=C', "C X2 C Y1\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
# Test override of define/endef
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
run_make_test('
|
|
|
|
override define foo
|
|
|
|
@echo First comes the definition.
|
|
|
|
@echo Then comes the override.
|
|
|
|
endef
|
|
|
|
all: ; $(foo)
|
|
|
|
',
|
|
|
|
'foo=Hello', "First comes the definition.\nThen comes the override.\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
|
2009-06-04 06:30:27 +00:00
|
|
|
1;
|