Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / usr.bin / make / unit-tests / varcmd
blob60343acb2528bc2d6b3163c7a2fae3696c36f18b
1 # $Id: varcmd,v 1.3 2008/05/14 14:27:02 sjg Exp $
3 # Test behaviour of recursive make and vars set on command line.
5 FU=fu
6 FOO?=foo
7 .if !empty(.TARGETS)
8 TAG=${.TARGETS}
9 .endif
10 TAG?=default
12 all:    one
14 show:
15         @echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>"
17 one:    show
18         @${.MAKE} -f ${MAKEFILE} FU=bar FOO=goo two
20 two:    show
21         @${.MAKE} -f ${MAKEFILE} three
23 three:  show
24         @${.MAKE} -f ${MAKEFILE} four
27 .ifmake four
28 VAR=Internal
29 .MAKEOVERRIDES+= VAR
30 .endif
32 four:   show
33         @${.MAKE} -f ${MAKEFILE} five
35 M = x
36 V.y = is y
37 V.x = is x
38 V := ${V.$M}
39 K := ${V}
41 show-v:
42         @echo '${TAG} v=${V} k=${K}'
44 five:   show show-v
45         @${.MAKE} -f ${MAKEFILE} M=y six
47 six:    show-v
48         @${.MAKE} -f ${MAKEFILE} V=override show-v