3
$description = "Test the origin function.";
5
$details = "This is a test of the origin function in gnu make.
6
This function will report on where a variable was
7
defined per the following list:
9
'undefined' never defined
10
'default' default definition
11
'environment' environment var without -e
12
'environment override' environment var with -e
13
'file' defined in makefile
14
'command line' defined on the command line
15
'override' defined by override in makefile
16
'automatic' Automatic variable\n";
18
# On WIN32 systems, HOME is meaningless. SystemRoot should be defined
19
# though. With DJGPP, HOME is not guaranteed to be defined. Use DJDIR
22
$homevar = (($port_type eq 'Windows') ? "SystemRoot"
23
: (($port_type eq 'DOS') ? "DJDIR"
26
open(MAKEFILE,"> $makefile");
30
auto_var = udef CC $homevar MAKE foo CFLAGS WHITE \@
31
av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
32
override WHITE := BLACK
34
\t\@echo \$(origin undefined)
35
\t\@echo \$(origin CC)
36
\t\@echo \$(origin $homevar)
37
\t\@echo \$(origin MAKE)
38
\t\@echo \$(origin foo)
39
\t\@echo \$(origin CFLAGS)
40
\t\@echo \$(origin WHITE)
41
\t\@echo \$(origin \@)
48
&run_make_with_options($makefile,
49
"-e WHITE=WHITE CFLAGS=",
52
# Create the answer to what should be produced by this Makefile
53
$answer = "undefined default environment default file command line override automatic
64
&compare_output($answer,&get_logfile(1));