Home | History | Annotate | Line # | Download | only in unit-tests
      1  1.7  rillig # $NetBSD: varcmd.mk,v 1.7 2023/04/07 05:54:16 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.7  rillig #
     16  1.7  rillig # See also:
     17  1.7  rillig #	var-scope-cmdline.mk
     18  1.7  rillig #	varname-makeflags.mk
     19  1.1     apb 
     20  1.5  rillig FU=	fu
     21  1.5  rillig FOO?=	foo
     22  1.1     apb .if !empty(.TARGETS)
     23  1.5  rillig TAG=	${.TARGETS}
     24  1.1     apb .endif
     25  1.5  rillig TAG?=	default
     26  1.1     apb 
     27  1.1     apb all:	one
     28  1.1     apb 
     29  1.1     apb show:
     30  1.1     apb 	@echo "${TAG} FU=<v>${FU}</v> FOO=<v>${FOO}</v> VAR=<v>${VAR}</v>"
     31  1.1     apb 
     32  1.1     apb one:	show
     33  1.3     sjg 	@${.MAKE} -f ${MAKEFILE} FU=bar FOO+=goo two
     34  1.1     apb 
     35  1.1     apb two:	show
     36  1.1     apb 	@${.MAKE} -f ${MAKEFILE} three
     37  1.1     apb 
     38  1.1     apb three:	show
     39  1.1     apb 	@${.MAKE} -f ${MAKEFILE} four
     40  1.1     apb 
     41  1.1     apb 
     42  1.2     sjg .ifmake two
     43  1.2     sjg # this should not work
     44  1.2     sjg FU+= oops
     45  1.3     sjg FOO+= oops
     46  1.2     sjg _FU:= ${FU}
     47  1.3     sjg _FOO:= ${FOO}
     48  1.2     sjg two: immutable
     49  1.2     sjg immutable:
     50  1.2     sjg 	@echo "$@ FU='${_FU}'"
     51  1.3     sjg 	@echo "$@ FOO='${_FOO}'"
     52  1.2     sjg .endif
     53  1.1     apb .ifmake four
     54  1.1     apb VAR=Internal
     55  1.1     apb .MAKEOVERRIDES+= VAR
     56  1.1     apb .endif
     57  1.1     apb 
     58  1.1     apb four:	show
     59  1.1     apb 	@${.MAKE} -f ${MAKEFILE} five
     60  1.1     apb 
     61  1.5  rillig M=	x
     62  1.5  rillig V.y=	is y
     63  1.5  rillig V.x=	is x
     64  1.5  rillig V:=	${V.$M}
     65  1.5  rillig K:=	${V}
     66  1.1     apb 
     67  1.1     apb show-v:
     68  1.1     apb 	@echo '${TAG} v=${V} k=${K}'
     69  1.1     apb 
     70  1.1     apb five:	show show-v
     71  1.1     apb 	@${.MAKE} -f ${MAKEFILE} M=y six
     72  1.1     apb 
     73  1.1     apb six:	show-v
     74  1.1     apb 	@${.MAKE} -f ${MAKEFILE} V=override show-v
     75