diff options
author | Paul Smith <psmith@gnu.org> | 1999-09-14 02:03:19 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 1999-09-14 02:03:19 +0000 |
commit | 0d366b668244112846554c42045ff1d9956276ed (patch) | |
tree | 3802242fe18a5e90d889f5d1ac66fb487361888b /tests/scripts/functions/origin | |
parent | 4121dea6a59367b4431cbe7a3c43d74fec9fd832 (diff) | |
download | gunmake-0d366b668244112846554c42045ff1d9956276ed.tar.gz |
* Added the test suite to the main distribution.
Diffstat (limited to 'tests/scripts/functions/origin')
-rw-r--r-- | tests/scripts/functions/origin | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin new file mode 100644 index 0000000..721d928 --- /dev/null +++ b/tests/scripts/functions/origin @@ -0,0 +1,65 @@ +# -*-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"; + +# On WIN32 systems, HOME is meaningless. SystemRoot should be defined though. +# With DJGPP, HOME is not guaranteed to be defined. Use DJDIR instead. +# +$homevar = (($osname =~ /Windows/i) + ? "SystemRoot" + : (($osname =~ /DOS/i) ? "DJDIR" : "HOME")); + +open(MAKEFILE,"> $makefile"); + +print MAKEFILE <<EOF; +foo := bletch garf +auto_var = udef CC $homevar MAKE foo CFLAGS WHITE \@ +av = \$(foreach var, \$(auto_var), \$(origin \$(var)) ) +override WHITE := BLACK +all: auto +\t\@echo \$(origin undefined) +\t\@echo \$(origin CC) +\t\@echo \$(origin $homevar) +\t\@echo \$(origin MAKE) +\t\@echo \$(origin foo) +\t\@echo \$(origin CFLAGS) +\t\@echo \$(origin WHITE) +\t\@echo \$(origin \@) +auto : +\t\@echo \$(av) +EOF + +close(MAKEFILE); + +&run_make_with_options($makefile, + "-e WHITE=WHITE CFLAGS=", + &get_logfile); + +# Create the answer to what should be produced by this Makefile +$answer = "undefined default environment default file command line override automatic +undefined +default +environment +default +file +command line +override +automatic\n"; + + +&compare_output($answer,&get_logfile(1)); + +1; |