Home | History | Annotate | Line # | Download | only in unit-tests
varcmd.mk revision 1.6
      1  1.6  rillig # $NetBSD: varcmd.mk,v 1.6 2021/02/16 19:43:09 rillig Exp $
      2  1.1     apb #
      3  1.1     apb # Test behaviour of recursive make and vars set on command line.
      4  1.6  rillig #
      5  1.6  rillig # FIXME: The purpose of this test is unclear.  The test uses six levels of
      6  1.6  rillig # sub-makes, which makes it incredibly hard to understand.  There must be at
      7  1.6  rillig # least an introductory explanation about what _should_ happen here.
      8  1.6  rillig # The variable names are terrible, as well as their values.
      9  1.6  rillig #
     10  1.6  rillig # This test produces different results if the large block with the condition
     11  1.6  rillig # "scope == SCOPE_GLOBAL" in Var_SetWithFlags is removed.  This test should
     12  1.6  rillig # be rewritten to make it clear why there is a difference and why this is
     13  1.6  rillig # actually intended.  Removing that large block of code makes only this test
     14  1.6  rillig # and vardebug.mk fail, which is not enough.
     15  1.1     apb 
     16  1.5  rillig FU=	fu
     17  1.5  rillig FOO?=	foo
     18  1.1     apb .if !empty(.TARGETS)
     19  1.5  rillig TAG=	${.TARGETS}
     20  1.1     apb .endif
     21  1.5  rillig TAG?=	default
     22  1.1     apb 
     23  1.1     apb all:	one
     24  1.1     apb 
     25  1.1     apb show:
     26  1.1     apb 	@echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>"
     27  1.1     apb 
     28  1.1     apb one:	show
     29  1.3     sjg 	@${.MAKE} -f ${MAKEFILE} FU=bar FOO+=goo two
     30  1.1     apb 
     31  1.1     apb two:	show
     32  1.1     apb 	@${.MAKE} -f ${MAKEFILE} three
     33  1.1     apb 
     34  1.1     apb three:	show
     35  1.1     apb 	@${.MAKE} -f ${MAKEFILE} four
     36  1.1     apb 
     37  1.1     apb 
     38  1.2     sjg .ifmake two
     39  1.2     sjg # this should not work
     40  1.2     sjg FU+= oops
     41  1.3     sjg FOO+= oops
     42  1.2     sjg _FU:= ${FU}
     43  1.3     sjg _FOO:= ${FOO}
     44  1.2     sjg two: immutable
     45  1.2     sjg immutable:
     46  1.2     sjg 	@echo "$@ FU='${_FU}'"
     47  1.3     sjg 	@echo "$@ FOO='${_FOO}'"
     48  1.2     sjg .endif
     49  1.1     apb .ifmake four
     50  1.1     apb VAR=Internal
     51  1.1     apb .MAKEOVERRIDES+= VAR
     52  1.1     apb .endif
     53  1.1     apb 
     54  1.1     apb four:	show
     55  1.1     apb 	@${.MAKE} -f ${MAKEFILE} five
     56  1.1     apb 
     57  1.5  rillig M=	x
     58  1.5  rillig V.y=	is y
     59  1.5  rillig V.x=	is x
     60  1.5  rillig V:=	${V.$M}
     61  1.5  rillig K:=	${V}
     62  1.1     apb 
     63  1.1     apb show-v:
     64  1.1     apb 	@echo '${TAG} v=${V} k=${K}'
     65  1.1     apb 
     66  1.1     apb five:	show show-v
     67  1.1     apb 	@${.MAKE} -f ${MAKEFILE} M=y six
     68  1.1     apb 
     69  1.1     apb six:	show-v
     70  1.1     apb 	@${.MAKE} -f ${MAKEFILE} V=override show-v
     71