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

📄 export

📁 make debug tool. You can use this tool to debug Makefile
💻
字号:
#                                                                    -*-perl-*-# $Id: export,v 1.4 2005/12/04 19:40:34 rockyb Exp $$description = "Check GNU make export/unexport commands.";$details = "TEST  1: basic functioningTEST  2: make sure variables inherited from the parent are exportedTEST  3: global export.  Explicit unexport takes precedence.TEST  4: global unexport.  Explicit export takes precedence.TEST  5: both: in the above makefile the unexport comes last so that rules.TEST  6: pseudo target.TEST  7: expansion of variables inside exportTEST  8: expansion of variables inside unexportTEST  9: exporting multiple variables on the same lineTEST 10: unexporting multiple variables on the same lineCygwin (at least seems) to have trouble *removing* environmentvariables, so tests 4 and 5 are skipped on that platform.";# The test driver cleans out our environment for us so we don't have to worry# about that here.open(MAKEFILE,"> $makefile");# The Contents of the MAKEFILE ...print MAKEFILE <<'EOMAKE';FOO = fooBAR = barBOZ = bozexport BAZ = bazexport BOZBITZ = bitzBOTZ = botzexport BITZ BOTZunexport BOTZifdef EXPORT_ALLexportendififdef UNEXPORT_ALLunexportendififdef EXPORT_ALL_PSEUDO.EXPORT_ALL_VARIABLES:endifall:	@echo "FOO=$(FOO) BAR=$(BAR) BAZ=$(BAZ) BOZ=$(BOZ) BITZ=$(BITZ) BOTZ=$(BOTZ)"	@echo "FOO=$$FOO BAR=$$BAR BAZ=$$BAZ BOZ=$$BOZ BITZ=$$BITZ BOTZ=$$BOTZ"EOMAKEclose(MAKEFILE);sub run_test_compare($@) {    my $answer = shift @_;    map { $ENV{$_}=1; } @_;    run_make_with_options($makefile,"",&get_logfile,0);    &compare_output($answer,&get_logfile(1));    map { delete $ENV{$_}; } @_;}# TEST  1: basic functioning$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";run_test_compare($answer, ());# TEST  2: make sure variables inherited from the parent are exported$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO=foo BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";run_test_compare($answer, ('FOO'));# TEST  3: global export.  Explicit unexport takes precedence.$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";run_test_compare($answer, ('EXPORT_ALL'));# Cygwin (at least seems) to have trouble *removing* environment# variables.if ($osname !~ /^CYGWIN/) {    # TEST  4: global unexport.  Explicit export takes precedence.    $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";    run_test_compare($answer, ('UNEXPORT_ALL'));    # TEST 5: both: in the above makefile the unexport comes last so    # that rules.    $answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO= BAR= BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";    run_test_compare($answer, ('EXPORT_ALL', 'UNEXPORT_ALL'));}# TEST  6: pseudo target.&run_make_with_options($makefile,"EXPORT_ALL_PSEUDO=1",&get_logfile,0);$answer = "FOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=botzFOO=foo BAR=bar BAZ=baz BOZ=boz BITZ=bitz BOTZ=\n";run_test_compare($answer, ('EXPORT_ALL_PSEUDO'));# TEST  7: expansion of variables inside export$makefile2 = &get_tmpfile;open(MAKEFILE, "> $makefile2");print MAKEFILE <<'EOF';foo = f-okbar = b-okFOO = fooF = fBAR = barB = bexport $(FOO)export $(B)arall:	@echo foo=$(foo) bar=$(bar)	@echo foo=$$foo bar=$$barEOFclose(MAKEFILE);&run_make_with_options($makefile2,"",&get_logfile,0);$answer = "foo=f-ok bar=b-ok\nfoo=f-ok bar=b-ok\n";&compare_output($answer,&get_logfile(1));# TEST  8: expansion of variables inside unexport$makefile3 = &get_tmpfile;open(MAKEFILE, "> $makefile3");print MAKEFILE <<'EOF';foo = f-okbar = b-okFOO = fooF = fBAR = barB = bexport foo barunexport $(FOO)unexport $(B)arall:	@echo foo=$(foo) bar=$(bar)	@echo foo=$$foo bar=$$barEOFclose(MAKEFILE);&run_make_with_options($makefile3,"",&get_logfile,0);$answer = "foo=f-ok bar=b-ok\nfoo= bar=\n";&compare_output($answer,&get_logfile(1));# TEST  9: exporting multiple variables on the same line$makefile4 = &get_tmpfile;open(MAKEFILE, "> $makefile4");print MAKEFILE <<'EOF';A = aB = bC = cD = dE = eF = fG = gH = hI = iJ = jSOME = A B Cexport F G H I Jexport D E $(SOME)all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$JEOFclose(MAKEFILE);&run_make_with_options($makefile4,"",&get_logfile,0);$answer = "A=a B=b C=c D=d E=e F=f G=g H=h I=i J=j\n";&compare_output($answer,&get_logfile(1));# TEST 10: unexporting multiple variables on the same line$makefile5 = &get_tmpfile;open(MAKEFILE, "> $makefile5");print MAKEFILE <<'EOF';A = aB = bC = cD = dE = eF = fG = gH = hI = iJ = jSOME = A B Cunexport F G H I Junexport D E $(SOME)all: ; @echo A=$$A B=$$B C=$$C D=$$D E=$$E F=$$F G=$$G H=$$H I=$$I J=$$JEOFclose(MAKEFILE);@ENV{qw(A B C D E F G H I J)} = qw(1 2 3 4 5 6 7 8 9 10);&run_make_with_options($makefile5,"",&get_logfile,0);$answer = "A= B= C= D= E= F= G= H= I= J=\n";&compare_output($answer,&get_logfile(1));delete @ENV{qw(A B C D E F G H I J)};# This tells the test driver that the perl test script executed properly.1;

⌨️ 快捷键说明

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