VirtualBox

source: kBuild/trunk/src/gmake/tests/scripts/functions/origin@ 53

最後變更 在這個檔案從53是 53,由 bird 提交於 21 年 前

Initial revision

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.7 KB
 
1# -*-perl-*-
2
3$description = "Test the origin function.";
4
5$details = "This is a test of the origin function in gnu make.
6This function will report on where a variable was
7defined per the following list:
8
9'undefined' never defined
10'default' default definition
11'environment' environment var without -e
12'environment override' environment var with -e
13'file' defined in makefile
14'command line' defined on the command line
15'override' defined by override in makefile
16'automatic' Automatic variable\n";
17
18# On WIN32 systems, HOME is meaningless. SystemRoot should be defined
19# though. With DJGPP, HOME is not guaranteed to be defined. Use DJDIR
20# instead.
21#
22$homevar = (($port_type eq 'Windows') ? "SystemRoot"
23 : (($port_type eq 'DOS') ? "DJDIR"
24 : "HOME"));
25
26open(MAKEFILE,"> $makefile");
27
28print MAKEFILE <<EOF;
29foo := bletch garf
30auto_var = udef CC $homevar MAKE foo CFLAGS WHITE \@
31av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
32override WHITE := BLACK
33all: auto
34\t\@echo \$(origin undefined)
35\t\@echo \$(origin CC)
36\t\@echo \$(origin $homevar)
37\t\@echo \$(origin MAKE)
38\t\@echo \$(origin foo)
39\t\@echo \$(origin CFLAGS)
40\t\@echo \$(origin WHITE)
41\t\@echo \$(origin \@)
42auto :
43\t\@echo \$(av)
44EOF
45
46close(MAKEFILE);
47
48&run_make_with_options($makefile,
49 "-e WHITE=WHITE CFLAGS=",
50 &get_logfile);
51
52# Create the answer to what should be produced by this Makefile
53$answer = "undefined default environment default file command line override automatic
54undefined
55default
56environment
57default
58file
59command line
60override
61automatic\n";
62
63
64&compare_output($answer,&get_logfile(1));
65
661;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette