⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 targetvars

📁 make debug tool. You can use this tool to debug Makefile
💻
字号:
#                                                                    -*-perl-*-$description = "Test target-specific variable settings.";$details = "\Create a makefile containing various flavors of target-specific variablevalues, override and non-override, and using various variable expansionrules, semicolon interference, etc.";open(MAKEFILE,"> $makefile");print MAKEFILE <<'EOF';SHELL = /bin/shexport FOO = fooexport BAR = barone: override FOO = oneone two: ; @echo $(FOO) $(BAR)two: BAR = twothree: ; BAR=1000	@echo $(FOO) $(BAR)# Some things that shouldn't be target varsfunk : overridefunk : override adelicadelic override : ; echo $@# Test per-target recursive variablesfour:FOO=xfour:VAR$(FOO)=okfour: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'five:FOO=xfive six : VAR$(FOO)=goodfive six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'# Test per-target variable inheritanceseven: eightseven eight: ; @echo $@: $(FOO) $(BAR)seven: BAR = sevenseven: FOO = seveneight: BAR = eight# Test the export keyword with per-target variablesnine: ; @echo $(FOO) $(BAR) $$FOO $$BARnine: FOO = wallacenine-a: export BAZ = baznine-a: ; @echo $$BAZ# Test = escapingEQ = =ten: one\=twoten: one \= twoten one$(EQ)two $(EQ):;@echo $@.PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two# Test target-specific vars with pattern/suffix rulesQVAR = qvarRVAR = =%.q : ; @echo $(QVAR) $(RVAR)foo.q : RVAR += rvar# Target-specific vars with multiple LHS pattern rules%.r %.s %.t: ; @echo $(QVAR) $(RVAR) $(SVAR) $(TVAR)foo.r : RVAR += rvarfoo.t : TVAR := $(QVAR)EOFclose(MAKEFILE);# TEST #1&run_make_with_options($makefile, "one two three", &get_logfile);$answer = "one bar\nfoo two\nBAR=1000\nfoo bar\n";&compare_output($answer,&get_logfile(1));# TEST #2&run_make_with_options($makefile, "one two FOO=1 BAR=2", &get_logfile);$answer = "one 2\n1 2\n";&compare_output($answer,&get_logfile(1));# TEST #3&run_make_with_options($makefile, "four", &get_logfile);$answer = "x ok  ok\n";&compare_output($answer,&get_logfile(1));# TEST #4&run_make_with_options($makefile, "seven", &get_logfile);$answer = "eight: seven eight\nseven: seven seven\n";&compare_output($answer,&get_logfile(1));# TEST #5&run_make_with_options($makefile, "nine", &get_logfile);$answer = "wallace bar wallace bar\n";&compare_output($answer,&get_logfile(1));# TEST #5-a&run_make_with_options($makefile, "nine-a", &get_logfile);$answer = "baz\n";&compare_output($answer,&get_logfile(1));# TEST #6&run_make_with_options($makefile, "ten", &get_logfile);$answer = "one=two\none bar\n=\nfoo two\nten\n";&compare_output($answer,&get_logfile(1));# TEST #6&run_make_with_options($makefile, "foo.q bar.q", &get_logfile);$answer = "qvar = rvar\nqvar =\n";&compare_output($answer,&get_logfile(1));# TEST #7&run_make_with_options($makefile, "foo.t bar.s", &get_logfile);$answer = "qvar = qvar\nqvar =\n";&compare_output($answer,&get_logfile(1));# TEST #8# For PR/1378: Target-specific vars don't inherit correctly$makefile2 = &get_tmpfile;open(MAKEFILE,"> $makefile2");print MAKEFILE <<'EOF';foo: FOO = foobar: BAR = barfoo: barbar: bazbaz: ; @echo $(FOO) $(BAR)EOFclose(MAKEFILE);&run_make_with_options("$makefile2", "", &get_logfile);$answer = "foo bar\n";&compare_output($answer, &get_logfile(1));# TEST #9# For PR/1380: Using += assignment in target-specific variables sometimes fails# Also PR/1831$makefile3 = &get_tmpfile;open(MAKEFILE,"> $makefile3");print MAKEFILE <<'EOF';.PHONY: all oneall: FOO += bazall: one; @echo $(FOO)FOO = barone: FOO += bizone: FOO += bozone: ; @echo $(FOO)EOFclose(MAKEFILE);&run_make_with_options("$makefile3", "", &get_logfile);$answer = "bar baz biz boz\nbar baz\n";&compare_output($answer, &get_logfile(1));# Test #10&run_make_with_options("$makefile3", "one", &get_logfile);$answer = "bar biz boz\n";&compare_output($answer, &get_logfile(1));# Test #11# PR/1709: Test semicolons in target-specific variable values$makefile4 = &get_tmpfile;open(MAKEFILE, "> $makefile4");print MAKEFILE <<'EOF';foo : FOO = ; okfoo : ; @echo '$(FOO)'EOFclose(MAKEFILE);&run_make_with_options("$makefile4", "", &get_logfile);$answer = "; ok\n";&compare_output($answer, &get_logfile(1));# Test #12# PR/2020: More hassles with += target-specific vars.  I _really_ think# I nailed it this time :-/.$makefile5 = &get_tmpfile;open(MAKEFILE, "> $makefile5");print MAKEFILE <<'EOF';.PHONY: aBLAH := fooCOMMAND = echo $(BLAH)a: ; @$(COMMAND)a: BLAH := bara: COMMAND += snafu $(BLAH)EOFclose(MAKEFILE);&run_make_with_options("$makefile5", "", &get_logfile);$answer = "bar snafu bar\n";&compare_output($answer, &get_logfile(1));# Test #13# Test double-colon rules with target-specific variable values$makefile6 = &get_tmpfile;open(MAKEFILE, "> $makefile6");print MAKEFILE <<'EOF';W = badX = badfoo: W = okfoo:: ; @echo $(W) $(X) $(Y) $(Z)foo:: ; @echo $(W) $(X) $(Y) $(Z)foo: X = okY = foobar: foobar: Y = barZ = nopatifdef PATTERN  fo% : Z = patendifEOFclose(MAKEFILE);&run_make_with_options("$makefile6", "foo", &get_logfile);$answer = "ok ok foo nopat\nok ok foo nopat\n";&compare_output($answer, &get_logfile(1));# Test #14# Test double-colon rules with target-specific variable values and# inheritance&run_make_with_options("$makefile6", "bar", &get_logfile);$answer = "ok ok bar nopat\nok ok bar nopat\n";&compare_output($answer, &get_logfile(1));# Test #15# Test double-colon rules with pattern-specific variable values&run_make_with_options("$makefile6", "foo PATTERN=yes", &get_logfile);$answer = "ok ok foo pat\nok ok foo pat\n";&compare_output($answer, &get_logfile(1));# Test #16# Test target-specific variables with very long command line# (> make default buffer length)$makefile7 = &get_tmpfile;open(MAKEFILE, "> $makefile7");print MAKEFILE <<'EOF';base_metals_fmd_reports.sun5 base_metals_fmd_reports CreateRealPositions        CreateMarginFunds deals_changed_since : BUILD_OBJ=$(shell if [ -f               "build_information.generate" ]; then echo "$(OBJ_DIR)/build_information.o"; else echo "no build information"; fi  )deals_changed_since: ; @echo $(BUILD_OBJ)EOFclose(MAKEFILE);&run_make_with_options("$makefile7", '', &get_logfile);$answer = "no build information\n";&compare_output($answer, &get_logfile(1));# TEST #17# Test a merge of set_lists for files, where one list is much longer# than the other.  See Savannah bug #15757.mkdir('t1', 0777);touch('t1/rules.mk');run_make_test('VPATH = t1include rules.mk.PHONY: allall: foo.xfoo.x : rules.mk ; @echo MYVAR=$(MYVAR) FOOVAR=$(FOOVAR) ALLVAR=$(ALLVAR)all: ALLVAR = xxxfoo.x: FOOVAR = barrules.mk : MYVAR = foo.INTERMEDIATE: foo.x rules.mk',              '-I t1',              'MYVAR= FOOVAR=bar ALLVAR=xxx');rmfiles('t1/rules.mk');rmdir('t1');# TEST #18# Test appending to a simple variable containing a "$": avoid a# double-expansion.  See Savannah bug #15913.run_make_test("VAR := \$\$FOOfoo: VAR += BARfoo: ; \@echo '\$(VAR)'",              '',              '$FOO BAR');1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -