📄 patspecific_vars
字号:
# -*-perl-*-$description = "Test pattern-specific variable settings.";$details = "\Create a makefile containing various flavors of pattern-specific variablesettings, override and non-override, and using various variable expansionrules, semicolon interference, etc.";open(MAKEFILE,"> $makefile");print MAKEFILE <<'EOF';all: one.x two.x three.xFOO = fooBAR = barBAZ = bazone.x: override FOO = one%.x: BAR = twot%.x: BAR = fourthr% : override BAZ = threeone.x two.x three.x: ; @echo $@: $(FOO) $(BAR) $(BAZ)four.x: baz ; @echo $@: $(FOO) $(BAR) $(BAZ)baz: ; @echo $@: $(FOO) $(BAR) $(BAZ)# test matching multiple patternsa%: AAA = aaa%b: BBB = ccca%: BBB += ddd%b: AAA ?= xxx%b: AAA += bbb.PHONY: abab: ; @echo $(AAA); echo $(BBB)EOFclose(MAKEFILE);# TEST #1 -- basics&run_make_with_options($makefile, "", &get_logfile);$answer = "one.x: one two baz\ntwo.x: foo four baz\nthree.x: foo four three\n";&compare_output($answer,&get_logfile(1));# TEST #2 -- try the override feature&run_make_with_options($makefile, "BAZ=five", &get_logfile);$answer = "one.x: one two five\ntwo.x: foo four five\nthree.x: foo four three\n";&compare_output($answer,&get_logfile(1));# TEST #3 -- make sure patterns are inherited properly&run_make_with_options($makefile, "four.x", &get_logfile);$answer = "baz: foo two baz\nfour.x: foo two baz\n";&compare_output($answer,&get_logfile(1));# TEST #4 -- test multiple patterns matching the same target&run_make_with_options($makefile, "ab", &get_logfile);$answer = "aaa bbb\nccc ddd\n";&compare_output($answer,&get_logfile(1));# TEST #5 -- test pattern-specific exported variables#run_make_test('/%: export foo := foo/bar: @echo $(foo) $$foo', '', 'foo foo');# TEST #6 -- test expansion of pattern-specific simple variables#run_make_test('.PHONY: allall: inherit := good $$tall: bar bazb%: pattern := good $$tglobal := orginal $$t# normal target#ifdef recbar: a = global: $(global) pattern: $(pattern) inherit: $(inherit)elsebar: a := global: $(global) pattern: $(pattern) inherit: $(inherit)endifbar: ; @echo \'normal: $a;\'# pattern target#ifdef rec%z: a = global: $(global) pattern: $(pattern) inherit: $(inherit)else%z: a := global: $(global) pattern: $(pattern) inherit: $(inherit)endif%z: ; @echo \'pattrn: $a;\'global := new $$t','','normal: global: orginal $t pattern: inherit: ;pattrn: global: orginal $t pattern: inherit: ;');# TEST #7 -- test expansion of pattern-specific recursive variables#run_make_test(undef, # reuse previous makefile'rec=1','normal: global: new $t pattern: good $t inherit: good $t;pattrn: global: new $t pattern: good $t inherit: good $t;');1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -