1*0a6a1f1dSLionel Sambuc# $Id: varcmd.mk,v 1.1 2014/08/21 13:44:52 apb Exp $ 2*0a6a1f1dSLionel Sambuc# 3*0a6a1f1dSLionel Sambuc# Test behaviour of recursive make and vars set on command line. 4*0a6a1f1dSLionel Sambuc 5*0a6a1f1dSLionel SambucFU=fu 6*0a6a1f1dSLionel SambucFOO?=foo 7*0a6a1f1dSLionel Sambuc.if !empty(.TARGETS) 8*0a6a1f1dSLionel SambucTAG=${.TARGETS} 9*0a6a1f1dSLionel Sambuc.endif 10*0a6a1f1dSLionel SambucTAG?=default 11*0a6a1f1dSLionel Sambuc 12*0a6a1f1dSLionel Sambucall: one 13*0a6a1f1dSLionel Sambuc 14*0a6a1f1dSLionel Sambucshow: 15*0a6a1f1dSLionel Sambuc @echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>" 16*0a6a1f1dSLionel Sambuc 17*0a6a1f1dSLionel Sambucone: show 18*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} FU=bar FOO=goo two 19*0a6a1f1dSLionel Sambuc 20*0a6a1f1dSLionel Sambuctwo: show 21*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} three 22*0a6a1f1dSLionel Sambuc 23*0a6a1f1dSLionel Sambucthree: show 24*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} four 25*0a6a1f1dSLionel Sambuc 26*0a6a1f1dSLionel Sambuc 27*0a6a1f1dSLionel Sambuc.ifmake four 28*0a6a1f1dSLionel SambucVAR=Internal 29*0a6a1f1dSLionel Sambuc.MAKEOVERRIDES+= VAR 30*0a6a1f1dSLionel Sambuc.endif 31*0a6a1f1dSLionel Sambuc 32*0a6a1f1dSLionel Sambucfour: show 33*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} five 34*0a6a1f1dSLionel Sambuc 35*0a6a1f1dSLionel SambucM = x 36*0a6a1f1dSLionel SambucV.y = is y 37*0a6a1f1dSLionel SambucV.x = is x 38*0a6a1f1dSLionel SambucV := ${V.$M} 39*0a6a1f1dSLionel SambucK := ${V} 40*0a6a1f1dSLionel Sambuc 41*0a6a1f1dSLionel Sambucshow-v: 42*0a6a1f1dSLionel Sambuc @echo '${TAG} v=${V} k=${K}' 43*0a6a1f1dSLionel Sambuc 44*0a6a1f1dSLionel Sambucfive: show show-v 45*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} M=y six 46*0a6a1f1dSLionel Sambuc 47*0a6a1f1dSLionel Sambucsix: show-v 48*0a6a1f1dSLionel Sambuc @${.MAKE} -f ${MAKEFILE} V=override show-v 49*0a6a1f1dSLionel Sambuc 50