xref: /freebsd/contrib/bmake/unit-tests/varcmd.mk (revision 396c556d77189a5c474d35cec6f44a762e310b7d)
1# $Id: varcmd.mk,v 1.1.1.1 2014/08/30 18:57:18 sjg Exp $
2#
3# Test behaviour of recursive make and vars set on command line.
4
5FU=fu
6FOO?=foo
7.if !empty(.TARGETS)
8TAG=${.TARGETS}
9.endif
10TAG?=default
11
12all:	one
13
14show:
15	@echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>"
16
17one:	show
18	@${.MAKE} -f ${MAKEFILE} FU=bar FOO=goo two
19
20two:	show
21	@${.MAKE} -f ${MAKEFILE} three
22
23three:	show
24	@${.MAKE} -f ${MAKEFILE} four
25
26
27.ifmake four
28VAR=Internal
29.MAKEOVERRIDES+= VAR
30.endif
31
32four:	show
33	@${.MAKE} -f ${MAKEFILE} five
34
35M = x
36V.y = is y
37V.x = is x
38V := ${V.$M}
39K := ${V}
40
41show-v:
42	@echo '${TAG} v=${V} k=${K}'
43
44five:	show show-v
45	@${.MAKE} -f ${MAKEFILE} M=y six
46
47six:	show-v
48	@${.MAKE} -f ${MAKEFILE} V=override show-v
49
50