VirtualBox

source: kBuild/vendor/gnumake/current/tests/scripts/features/se_explicit

最後變更 在這個檔案是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 LF
檔案大小: 2.6 KB
 
1# -*-perl-*-
2$description = "Test second expansion in ordinary rules.";
3
4$details = "";
5
6# TEST #0: Test handing of '$' in prerequisites with and without second
7# expansion.
8
9# If we don't support archives then the prerequisite is different
10my $prereq = exists $FEATURES{'archives'} ? '$' : '$(PRE)';
11
12run_make_test(q!
13ifdef SE
14 .SECONDEXPANSION:
15endif
16foo$$bar: bar$$baz bar$$biz ; @echo '$@ : $^'
17PRE = one two
18bar$$baz: $$(PRE)
19baraz: $$(PRE)
20PRE = three four
21.DEFAULT: ; @echo '$@'
22!,
23 '',
24 "$prereq\nbar\$biz\nfoo\$bar : bar\$baz bar\$biz");
25
26run_make_test(undef, 'SE=1', "three\nfour\nbariz\nfoo\$bar : baraz bariz");
27
28# TEST #1: automatic variables.
29#
30run_make_test(q!
31.SECONDEXPANSION:
32.DEFAULT: ; @echo '$@'
33
34foo: bar baz
35
36foo: biz | buz
37
38foo: [email protected] \
39 $$<.2 \
40 $$(addsuffix .3,$$^) \
41 $$(addsuffix .4,$$+) \
42 $$|.5 \
43 $$*.6
44
45!,
46'',
47'bar
48baz
49biz
50buz
51foo.1
52bar.2
53bar.3
54baz.3
55biz.3
56bar.4
57baz.4
58biz.4
59buz.5
60.6
61');
62
63
64# Test #2: target/pattern -specific variables.
65#
66run_make_test(q!
67.SECONDEXPANSION:
68.DEFAULT: ; @echo '$@'
69
70foo.x: $$a $$b
71
72foo.x: a := bar
73
74%.x: b := baz
75!,
76'',
77'bar
78baz
79');
80
81
82# Test #3: order of prerequisites.
83#
84run_make_test(q!
85.SECONDEXPANSION:
86.DEFAULT: ; @echo '$@'
87
88all: foo bar baz
89
90# Subtest #1
91foo: foo.1; @:
92foo: foo.2
93foo: foo.3
94
95# Subtest #2
96bar: bar.2
97bar: bar.1; @:
98bar: bar.3
99
100# Subtest #3
101baz: baz.1
102baz: baz.2
103baz: ; @:
104!,
105'',
106'foo.1
107foo.2
108foo.3
109bar.1
110bar.2
111bar.3
112baz.1
113baz.2
114');
115
116# TEST #4: eval in a context where there is no reading_file
117run_make_test(q!
118.SECONDEXPANSION:
119all : $$(eval $$(info test))
120!,
121 '', "test\n#MAKE#: Nothing to be done for 'all'.\n");
122
123# TEST #5: (NEGATIVE) catch eval in a prereq list trying to create new
124# target/prereq relationships.
125
126run_make_test(q!
127.SECONDEXPANSION:
128proj1.exe : proj1.o $$(eval $$(test))
129define test
130proj1.o : proj1.c
131proj1.c: proj1.h
132endef
133!,
134 '', "#MAKE#: *** prerequisites cannot be defined in recipes. Stop.\n", 512);
135
136
137# Automatic $$+ variable expansion issue. Savannah bug #25780
138run_make_test(q!
139all : foo foo
140.SECONDEXPANSION:
141all : $$+ ; @echo '$+'
142foo : ;
143!,
144 '', "foo foo foo foo\n");
145
146
147# Automatic $$+ variable expansion issue. Savannah bug #25780
148run_make_test(q!
149all : bar bar
150bar : ;
151q%x : ;
152.SECONDEXPANSION:
153a%l: q1x $$+ q2x ; @echo '$+'
154!,
155 '', "q1x bar bar q2x bar bar\n");
156
157
158# Allow patsubst shorthand in second expansion context.
159# Requires the colon to be quoted. Savannah bug #16545
160run_make_test(q!
161.PHONY: foo.bar
162.SECONDEXPANSION:
163foo: $$(@\\:%=%.bar); @echo '$^'
164!,
165 '', "foo.bar\n");
166
1671;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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