1999-09-14 02:03:19 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test various flavors of make variable setting.";
|
|
|
|
|
|
|
|
$details = "";
|
|
|
|
|
|
|
|
open(MAKEFILE, "> $makefile");
|
|
|
|
|
|
|
|
# The Contents of the MAKEFILE ...
|
|
|
|
|
|
|
|
print MAKEFILE <<'EOF';
|
|
|
|
foo = $(bar)
|
|
|
|
bar = ${ugh}
|
|
|
|
ugh = Hello
|
|
|
|
|
|
|
|
all: multi ; @echo $(foo)
|
|
|
|
|
|
|
|
multi: ; $(multi)
|
|
|
|
|
|
|
|
x := foo
|
|
|
|
y := $(x) bar
|
|
|
|
x := later
|
|
|
|
|
|
|
|
nullstring :=
|
|
|
|
space := $(nullstring) $(nullstring)
|
|
|
|
|
|
|
|
next: ; @echo $x$(space)$y
|
|
|
|
|
|
|
|
define multi
|
|
|
|
@echo hi
|
2001-05-21 06:16:00 +00:00
|
|
|
echo there
|
1999-09-14 02:03:19 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
ifdef BOGUS
|
|
|
|
define
|
|
|
|
@echo error
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2002-07-08 02:26:47 +00:00
|
|
|
define outer
|
|
|
|
define inner
|
|
|
|
A = B
|
|
|
|
endef
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(outer))
|
|
|
|
|
|
|
|
outer: ; @echo $(inner)
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# END of Contents of MAKEFILE
|
|
|
|
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
|
|
|
# TEST #1
|
|
|
|
# -------
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "", &get_logfile);
|
2001-05-21 06:16:00 +00:00
|
|
|
$answer = "hi\necho there\nthere\nHello\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #2
|
|
|
|
# -------
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "next", &get_logfile);
|
|
|
|
$answer = "later foo bar\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
|
|
|
# TEST #3
|
|
|
|
# -------
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "BOGUS=true", &get_logfile, 512);
|
|
|
|
$answer = "$makefile:23: *** empty variable name. Stop.\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
2002-07-08 02:26:47 +00:00
|
|
|
# TEST #4
|
|
|
|
# -------
|
|
|
|
|
|
|
|
&run_make_with_options($makefile, "outer", &get_logfile);
|
|
|
|
$answer = "A = B\n";
|
|
|
|
&compare_output($answer, &get_logfile(1));
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
1;
|