Makefile revision 98461
1239313Sdim# $FreeBSD: head/tools/build/make_check/Makefile 98461 2002-06-20 03:08:20Z jmallett $
2239313Sdim
3239313Sdim# Test for broken LHS expansion.
4239313Sdim# This *must* case make(1) to detect a recursive variable, and fail as such.
5239313Sdim.if make(lhs_expn)
6239313SdimFOO=		${BAR}
7239313SdimBAR${NIL}=	${FOO}
8239313SdimFOO${BAR}=	${FOO}
9239313Sdim.endif
10239313Sdim
11249423SdimDATA1=	helllo
12249423SdimDATA2:=	${DATA1}
13239313SdimDATA3=	${DATA2:S/ll/rr/g}
14249423SdimDATA4:=	${DATA2:S/ll/rr/g}
15239313SdimDATA2?=	allo
16239313SdimDATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g}
17239313SdimDATA2=	yello
18239313SdimDATA1:=	${DATA5:S/l/r/g}
19263508SdimNIL=
20263508Sdim
21263508Sdimall:
22263508Sdim	@echo "Running test variables"
23263508Sdim	@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
24263508Sdim		diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
25263508Sdim	@echo "PASS: Test variables detected no regression, output matches."
26263508Sdim	@echo "Running test targets"
27263508Sdim	@${MAKE} double || ${MAKE} failure
28239313Sdim	@echo "PASS: Test targets detected no regression."
29239313Sdim	@echo "Running test sysvmatch"
30239313Sdim	@${MAKE} sysvmatch || ${MAKE} failure
31239313Sdim	@echo "PASS: Test sysvmatch detected no regression."
32239313Sdim	@echo "Running test lhs_expn"
33239313Sdim	@! ${MAKE} lhs_expn && true || ${MAKE} failure
34239313Sdim	@echo "PASS: Test lhs_expn detected no regression."
35239313Sdim
36239313Sdim# Doubly-defined targets.  NetBSD make(1) will warn, ours will silently use the
37239313Sdim# ``right'' one.
38239313Sdimdouble:
39239313Sdim	@true
40239313Sdim
41239313Sdimdouble:
42239313Sdim	@false
43239313Sdim
44239313Sdim# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst.
45239313Sdimsysvmatch:
46239313Sdim	@echo EMPTY ${NIL:=foo} LHS | \
47239313Sdim		diff -u ${.CURDIR}/regress.sysvmatch.out - || false
48239313Sdim
49239313Sdim# A bogus target for the lhs_expn test;  If this is reached, then the make(1)
50239313Sdim# program has not errored out because of the recursion caused by not expanding
51239313Sdim# the left-hand-side's embedded variables above.
52239313Sdimlhs_expn:
53239313Sdim	@true
54239313Sdim
55239313Sdimfailure:
56239313Sdim	@echo "FAIL: Test failed: regression detected.  See above."
57239313Sdim	@false
58239313Sdim