| # -*-perl-*- |
| |
| $description = "Test special GNU Make variables."; |
| |
| $details = ""; |
| |
| run_make_test(q! |
| |
| X1 := $(sort $(filter FOO BAR,$(.VARIABLES))) |
| |
| FOO := foo |
| |
| X2 := $(sort $(filter FOO BAR,$(.VARIABLES))) |
| |
| BAR := bar |
| |
| all: ; @echo X1 = $(X1); echo X2 = $(X2); echo LAST = $(sort $(filter FOO BAR,$(.VARIABLES))) |
| !, |
| '', "X1 =\nX2 = FOO\nLAST = BAR FOO\n"); |
| |
| # SV 45728: Test that undefining a variable is reflected properly |
| |
| run_make_test(q! |
| FOO := foo |
| BAR := bar |
| $(info one: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) |
| undefine BAR |
| BAZ := baz |
| $(info two: $(sort $(filter FOO BAR BAZ,$(.VARIABLES)))) |
| all:;@: |
| !, |
| '', "one: BAR FOO\ntwo: BAZ FOO\n"); |
| |
| # $makefile2 = &get_tmpfile; |
| # open(MAKEFILE, "> $makefile2"); |
| |
| # print MAKEFILE <<'EOF'; |
| |
| # X1 := $(sort $(.TARGETS)) |
| |
| # all: foo |
| ##TAB#@echo X1 = $(X1) |
| ##TAB#@echo X2 = $(X2) |
| ##TAB#@echo LAST = $(sort $(.TARGETS)) |
| |
| # X2 := $(sort $(.TARGETS)) |
| |
| # foo: |
| |
| # EOF |
| |
| # close(MAKEFILE); |
| |
| # # TEST #2 |
| # # ------- |
| |
| # &run_make_with_options($makefile2, "", &get_logfile); |
| # $answer = "X1 =\nX2 = all\nLAST = all foo\n"; |
| # &compare_output($answer, &get_logfile(1)); |
| |
| # Test the .RECIPEPREFIX variable |
| run_make_test(q! |
| define foo |
| : foo-one\ |
| foo-two |
| : foo-three |
| #TAB#: foo-four |
| endef |
| |
| orig: ; : orig-one |
| #TAB#: orig-two \ |
| orig-three \ |
| #TAB#orig-four \ |
| #TAB##TAB#orig-five \\\\ |
| #TAB#: orig-six |
| #TAB#$(foo) |
| |
| .RECIPEPREFIX = > |
| test: ; : test-one |
| >: test-two \ |
| test-three \ |
| >test-four \ |
| >#TAB#test-five \\\\ |
| >: test-six |
| >$(foo) |
| |
| .RECIPEPREFIX = |
| reset: ; : reset-one |
| #TAB#: reset-two \ |
| reset-three \ |
| #TAB#reset-four \ |
| #TAB##TAB#reset-five \\\\ |
| #TAB#: reset-six |
| #TAB#$(foo) |
| !, |
| 'orig test reset', |
| ': orig-one |
| : orig-two \ |
| orig-three \ |
| orig-four \ |
| #TAB#orig-five \\\\ |
| : orig-six |
| : foo-one foo-two |
| : foo-three |
| : foo-four |
| : test-one |
| : test-two \ |
| test-three \ |
| test-four \ |
| #TAB#test-five \\\\ |
| : test-six |
| : foo-one foo-two |
| : foo-three |
| : foo-four |
| : reset-one |
| : reset-two \ |
| reset-three \ |
| reset-four \ |
| #TAB#reset-five \\\\ |
| : reset-six |
| : foo-one foo-two |
| : foo-three |
| : foo-four'); |
| |
| 1; |