make/tests/scripts/functions/origin
Paul Smith 6d8d9b74d9 Numerous updates to tests for issues found on Cygwin and Windows.
Revert a fix for $? including non-existent files as it shows a bug
in the Linux kernel build.  Give them a release to fix this.
Add some changes from Eli Z. for Windows changes.
2006-03-10 02:20:45 +00:00

52 lines
1.3 KiB
Perl

# -*-perl-*-
$description = "Test the origin function.";
$details = "This is a test of the origin function in gnu make.
This function will report on where a variable was
defined per the following list:
'undefined' never defined
'default' default definition
'environment' environment var without -e
'environment override' environment var with -e
'file' defined in makefile
'command line' defined on the command line
'override' defined by override in makefile
'automatic' Automatic variable\n";
# Set an environment variable
$extraENV{MAKETEST} = 1;
run_make_test('
foo := bletch garf
auto_var = undefined CC MAKETEST MAKE foo CFLAGS WHITE @
av = $(foreach var, $(auto_var), $(origin $(var)) )
override WHITE := BLACK
all: auto
@echo $(origin undefined)
@echo $(origin CC)
@echo $(origin MAKETEST)
@echo $(origin MAKE)
@echo $(origin foo)
@echo $(origin CFLAGS)
@echo $(origin WHITE)
@echo $(origin @)
auto :
@echo $(av)',
'-e WHITE=WHITE CFLAGS=',
'undefined default environment default file command line override automatic
undefined
default
environment
default
file
command line
override
automatic');
# Reset an environment variable
delete $extraENV{MAKETEST};
1;