Makefile (c997f47be0495366268899dad4f6441d7b31513c) Makefile (82eb7072de4af4c940301305e156f1847918e8f9)
1# $FreeBSD$
2
3# Test for broken LHS expansion.
4# This *must* cause make(1) to detect a recursive variable, and fail as such.
5.if make(lhs_expn)
6FOO= ${BAR}
7BAR${NIL}= ${FOO}
8FOO${BAR}= ${FOO}

--- 39 unchanged lines hidden (view full) ---

48 @${MAKE} PATH_exists || ${MAKE} failure
49 @echo "PASS: Test PATH_exists detected no regression."
50 @echo "Running test double_quotes"
51 @${MAKE} double_quotes || ${MAKE} failure
52 @echo "PASS: Test double_quotes detected no regression."
53 @echo "Running test double_quotes2"
54 @! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure
55 @echo "PASS: Test double_quotes2 detected no regression."
1# $FreeBSD$
2
3# Test for broken LHS expansion.
4# This *must* cause make(1) to detect a recursive variable, and fail as such.
5.if make(lhs_expn)
6FOO= ${BAR}
7BAR${NIL}= ${FOO}
8FOO${BAR}= ${FOO}

--- 39 unchanged lines hidden (view full) ---

48 @${MAKE} PATH_exists || ${MAKE} failure
49 @echo "PASS: Test PATH_exists detected no regression."
50 @echo "Running test double_quotes"
51 @${MAKE} double_quotes || ${MAKE} failure
52 @echo "PASS: Test double_quotes detected no regression."
53 @echo "Running test double_quotes2"
54 @! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure
55 @echo "PASS: Test double_quotes2 detected no regression."
56 @echo "Running test pass_cmd_vars "
56 @echo "Running test pass_cmd_vars"
57 @${MAKE} pass_cmd_vars || ${MAKE} failure
58 @echo "PASS: Test pass_cmd_vars detected no regression."
57 @${MAKE} pass_cmd_vars || ${MAKE} failure
58 @echo "PASS: Test pass_cmd_vars detected no regression."
59 @echo "Running test plus_flag "
59 @echo "Running test plus_flag"
60 @${MAKE} plus_flag || ${MAKE} failure
61 @echo "PASS: Test plus_flag detected no regression."
62
63.if make(double)
64# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
65# switches to using the "non-right" one, it breaks things worse than a little
66# regression test.
67double:

--- 82 unchanged lines hidden (view full) ---

150.endif
151
152.if make(pass_cmd_vars_1)
153# Check that the variable definition arrived from the calling make
154pass_cmd_vars_1:
155 @:
156
157.if ${CMD1} != cmd1 || ${CMD2} != cmd2
60 @${MAKE} plus_flag || ${MAKE} failure
61 @echo "PASS: Test plus_flag detected no regression."
62
63.if make(double)
64# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
65# switches to using the "non-right" one, it breaks things worse than a little
66# regression test.
67double:

--- 82 unchanged lines hidden (view full) ---

150.endif
151
152.if make(pass_cmd_vars_1)
153# Check that the variable definition arrived from the calling make
154pass_cmd_vars_1:
155 @:
156
157.if ${CMD1} != cmd1 || ${CMD2} != cmd2
158.error "variables not passed through MAKEFLAGS"
158.error variables not passed through MAKEFLAGS
159.endif
160
161# Check that the variable definition is in MAKEFLAGS
162.if ${.MAKEFLAGS:MCMD1=*} != "CMD1=cmd1" || ${.MAKEFLAGS:MCMD2=*} != "CMD2=cmd2"
159.endif
160
161# Check that the variable definition is in MAKEFLAGS
162.if ${.MAKEFLAGS:MCMD1=*} != "CMD1=cmd1" || ${.MAKEFLAGS:MCMD2=*} != "CMD2=cmd2"
163.error "variable assignment not found in $${MAKEFLAGS}"
163.error variable assignment not found in $${MAKEFLAGS}
164.endif
165
166# Check that the variable definition is not in MFLAGS
167.if ${MFLAGS:MCMD1=*} != "" || ${MFLAGS:MCMD2=*} != ""
164.endif
165
166# Check that the variable definition is not in MFLAGS
167.if ${MFLAGS:MCMD1=*} != "" || ${MFLAGS:MCMD2=*} != ""
168.error "variable assignment found in $${MFLAGS}"
168.error variable assignment found in $${MFLAGS}
169.endif
170.endif
171
172.if make(pass_cmd_vars_2)
173# Check that we cannot override the passed variables
174CMD1=foo1
175CMD2=foo2
176
177.if ${CMD1} != cmd1 || ${CMD2} != cmd2
169.endif
170.endif
171
172.if make(pass_cmd_vars_2)
173# Check that we cannot override the passed variables
174CMD1=foo1
175CMD2=foo2
176
177.if ${CMD1} != cmd1 || ${CMD2} != cmd2
178.error "MAKEFLAGS-passed variables overridden"
178.error MAKEFLAGS-passed variables overridden
179.endif
180
181pass_cmd_vars_2:
182 @:
183.endif
184
185.if make(pass_cmd_vars_3)
186# Check that we can override the passed variables on the next sub-make's
187# command line
188
189pass_cmd_vars_3:
190 @${MAKE} CMD1=foo1 pass_cmd_vars_3_1
191.endif
192
193.if make(pass_cmd_vars_3_1)
194.if ${CMD1} != foo1 || ${CMD2} != cmd2
179.endif
180
181pass_cmd_vars_2:
182 @:
183.endif
184
185.if make(pass_cmd_vars_3)
186# Check that we can override the passed variables on the next sub-make's
187# command line
188
189pass_cmd_vars_3:
190 @${MAKE} CMD1=foo1 pass_cmd_vars_3_1
191.endif
192
193.if make(pass_cmd_vars_3_1)
194.if ${CMD1} != foo1 || ${CMD2} != cmd2
195.error "MAKEFLAGS-passed variables not overridden on command line"
195.error MAKEFLAGS-passed variables not overridden on command line
196.endif
197pass_cmd_vars_3_1:
198 @:
199.endif
200
201.if make(pass_cmd_vars_4)
202# Ensure that a variable assignment passed via MAKEFLAGS may be overwritten
203# by evaluating the .MAKEFLAGS target.
204
205.MAKEFLAGS: CMD1=baz1
206
207pass_cmd_vars_4:
196.endif
197pass_cmd_vars_3_1:
198 @:
199.endif
200
201.if make(pass_cmd_vars_4)
202# Ensure that a variable assignment passed via MAKEFLAGS may be overwritten
203# by evaluating the .MAKEFLAGS target.
204
205.MAKEFLAGS: CMD1=baz1
206
207pass_cmd_vars_4:
208 @:
209# The following does not yet work (see standards/57295)
210# ${MAKE} pass_cmd_vars_4_1
208 @${MAKE} pass_cmd_vars_4_1
211
212.if ${CMD1} != baz1 || ${CMD2} != cmd2
209
210.if ${CMD1} != baz1 || ${CMD2} != cmd2
213.error "MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target"
211.error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target
214.endif
215
216.endif
217.if make(pass_cmd_vars_4_1)
218.if ${CMD1} != baz1 || ${CMD2} != cmd2
212.endif
213
214.endif
215.if make(pass_cmd_vars_4_1)
216.if ${CMD1} != baz1 || ${CMD2} != cmd2
219.error "MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target (2)"
217.error MAKEFLAGS-passed variables not overridden via .MAKEFLAGS target (2)
220.endif
221pass_cmd_vars_4_1:
222 @:
223.endif
224
225#
226# Test whether make supports the '+' flag (meaning: execute even with -n)
227#
228.if make(plus_flag)
229OUT != ${MAKE} -n plus_flag_1
230.if ${OUT} != "/tmp"
218.endif
219pass_cmd_vars_4_1:
220 @:
221.endif
222
223#
224# Test whether make supports the '+' flag (meaning: execute even with -n)
225#
226.if make(plus_flag)
227OUT != ${MAKE} -n plus_flag_1
228.if ${OUT} != "/tmp"
231.error "make doesn't handle + flag"
229.error make doesn't handle + flag
232.endif
233plus_flag:
234 @:
235.endif
236.if make(plus_flag_1)
237plus_flag_1:
238 +@cd /tmp; pwd
239.endif
240
241failure:
242 @echo "FAIL: Test failed: regression detected. See above."
243 @false
230.endif
231plus_flag:
232 @:
233.endif
234.if make(plus_flag_1)
235plus_flag_1:
236 +@cd /tmp; pwd
237.endif
238
239failure:
240 @echo "FAIL: Test failed: regression detected. See above."
241 @false