1999-09-14 10:03:19 +08:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test various flavors of make variable setting.";
|
|
|
|
|
|
|
|
$details = "";
|
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 0: Recursive
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
run_make_test('
|
|
|
|
ugh = Goodbye
|
1999-09-14 10:03:19 +08:00
|
|
|
foo = $(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
2009-06-04 14:30:27 +08:00
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Hello\n");
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 1: Simple
|
2004-09-21 13:39:04 +08:00
|
|
|
|
|
|
|
run_make_test('
|
2009-06-04 14:30:27 +08:00
|
|
|
bar = Goodbye
|
|
|
|
foo := $(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Goodbye\n");
|
2004-09-21 13:39:04 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 2: Append to recursive
|
2004-09-21 13:39:04 +08:00
|
|
|
|
|
|
|
run_make_test('
|
2009-06-04 14:30:27 +08:00
|
|
|
foo = Hello
|
|
|
|
ugh = Goodbye
|
|
|
|
foo += $(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Hello Hello\n");
|
2004-09-21 13:39:04 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 3: Append to simple
|
2004-09-21 13:39:04 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
run_make_test('
|
|
|
|
foo := Hello
|
|
|
|
ugh = Goodbye
|
|
|
|
bar = ${ugh}
|
|
|
|
foo += $(bar)
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Hello Goodbye\n");
|
2004-09-21 13:39:04 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 4: Conditional pre-set
|
2004-09-21 13:39:04 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
run_make_test('
|
|
|
|
foo = Hello
|
|
|
|
ugh = Goodbye
|
|
|
|
bar = ${ugh}
|
|
|
|
foo ?= $(bar)
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Hello\n");
|
1999-09-14 10:03:19 +08:00
|
|
|
|
2009-06-04 14:30:27 +08:00
|
|
|
# TEST 5: Conditional unset
|
2004-11-29 09:35:13 +08:00
|
|
|
|
|
|
|
run_make_test('
|
2009-06-04 14:30:27 +08:00
|
|
|
ugh = Goodbye
|
|
|
|
bar = ${ugh}
|
|
|
|
foo ?= $(bar)
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Hello\n");
|
2004-11-29 09:35:13 +08:00
|
|
|
|
2012-01-30 08:21:57 +08:00
|
|
|
# TEST 6: Simple using POSIX syntax
|
|
|
|
run_make_test('
|
|
|
|
bar = Goodbye
|
|
|
|
foo ::= $(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Goodbye\n");
|
|
|
|
|
|
|
|
# TEST 7: POSIX syntax no spaces
|
|
|
|
run_make_test('
|
|
|
|
bar = Goodbye
|
|
|
|
foo::=$(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
|
|
|
all: ; @echo $(foo)
|
|
|
|
',
|
|
|
|
'', "Goodbye\n");
|
|
|
|
|
2017-05-28 08:07:30 +08:00
|
|
|
# TEST 8: Append to empty
|
|
|
|
run_make_test(q!
|
|
|
|
recur =
|
|
|
|
recur += foo
|
|
|
|
simple :=
|
|
|
|
simple += bar
|
|
|
|
recur_empty = foo
|
|
|
|
recur_empty +=
|
|
|
|
simple_empty := bar
|
|
|
|
simple_empty +=
|
|
|
|
empty_recur =
|
|
|
|
empty_recur +=
|
|
|
|
empty_simple :=
|
|
|
|
empty_simple +=
|
|
|
|
|
|
|
|
all: ; @: $(info recur=/$(recur)/ simple=/$(simple)/ recure=/$(recur_empty)/ simplee=/$(simple_empty)/ erecur=/$(empty_recur)/ esimple=/$(empty_simple)/)
|
|
|
|
!,
|
|
|
|
'', "recur=/foo/ simple=/bar/ recure=/foo/ simplee=/bar/ erecur=// esimple=//\n");
|
|
|
|
|
1999-09-14 10:03:19 +08:00
|
|
|
1;
|