Makefile revision 98461
1# $FreeBSD: head/tools/build/make_check/Makefile 98461 2002-06-20 03:08:20Z jmallett $
2
3# Test for broken LHS expansion.
4# This *must* case make(1) to detect a recursive variable, and fail as such.
5.if make(lhs_expn)
6FOO=		${BAR}
7BAR${NIL}=	${FOO}
8FOO${BAR}=	${FOO}
9.endif
10
11DATA1=	helllo
12DATA2:=	${DATA1}
13DATA3=	${DATA2:S/ll/rr/g}
14DATA4:=	${DATA2:S/ll/rr/g}
15DATA2?=	allo
16DATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g}
17DATA2=	yello
18DATA1:=	${DATA5:S/l/r/g}
19NIL=
20
21all:
22	@echo "Running test variables"
23	@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
24		diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
25	@echo "PASS: Test variables detected no regression, output matches."
26	@echo "Running test targets"
27	@${MAKE} double || ${MAKE} failure
28	@echo "PASS: Test targets detected no regression."
29	@echo "Running test sysvmatch"
30	@${MAKE} sysvmatch || ${MAKE} failure
31	@echo "PASS: Test sysvmatch detected no regression."
32	@echo "Running test lhs_expn"
33	@! ${MAKE} lhs_expn && true || ${MAKE} failure
34	@echo "PASS: Test lhs_expn detected no regression."
35
36# Doubly-defined targets.  NetBSD make(1) will warn, ours will silently use the
37# ``right'' one.
38double:
39	@true
40
41double:
42	@false
43
44# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst.
45sysvmatch:
46	@echo EMPTY ${NIL:=foo} LHS | \
47		diff -u ${.CURDIR}/regress.sysvmatch.out - || false
48
49# A bogus target for the lhs_expn test;  If this is reached, then the make(1)
50# program has not errored out because of the recursion caused by not expanding
51# the left-hand-side's embedded variables above.
52lhs_expn:
53	@true
54
55failure:
56	@echo "FAIL: Test failed: regression detected.  See above."
57	@false
58