From e46c9ea201b4bad8f4c6d19ee6dfb3537bc9facd Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 26 Aug 2012 19:24:46 +0400 Subject: Imported GNU Make 3.81 --- tests/scripts/functions/origin | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/scripts/functions/origin (limited to 'tests/scripts/functions/origin') diff --git a/tests/scripts/functions/origin b/tests/scripts/functions/origin new file mode 100644 index 0000000..f7b7eb8 --- /dev/null +++ b/tests/scripts/functions/origin @@ -0,0 +1,51 @@ +# -*-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; -- cgit v1.2.3