2002-04-20 20:57:00 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2002-06-19 18:57:04 +00:00
|
|
|
# Test for broken LHS expansion.
|
2002-11-28 13:08:09 +00:00
|
|
|
# This *must* cause make(1) to detect a recursive variable, and fail as such.
|
2002-06-19 18:57:04 +00:00
|
|
|
.if make(lhs_expn)
|
|
|
|
FOO= ${BAR}
|
|
|
|
BAR${NIL}= ${FOO}
|
|
|
|
FOO${BAR}= ${FOO}
|
|
|
|
.endif
|
|
|
|
|
2002-04-20 20:57:00 +00:00
|
|
|
DATA1= helllo
|
|
|
|
DATA2:= ${DATA1}
|
|
|
|
DATA3= ${DATA2:S/ll/rr/g}
|
|
|
|
DATA4:= ${DATA2:S/ll/rr/g}
|
|
|
|
DATA2?= allo
|
|
|
|
DATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g}
|
|
|
|
DATA2= yello
|
|
|
|
DATA1:= ${DATA5:S/l/r/g}
|
2002-05-05 19:02:30 +00:00
|
|
|
NIL=
|
2002-04-20 20:57:00 +00:00
|
|
|
|
|
|
|
all:
|
|
|
|
@echo "Running test variables"
|
|
|
|
@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
|
|
|
|
diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure
|
2002-04-27 02:26:23 +00:00
|
|
|
@echo "PASS: Test variables detected no regression, output matches."
|
2002-04-21 00:41:37 +00:00
|
|
|
@echo "Running test targets"
|
|
|
|
@${MAKE} double || ${MAKE} failure
|
2002-04-27 02:26:23 +00:00
|
|
|
@echo "PASS: Test targets detected no regression."
|
2002-05-05 19:02:30 +00:00
|
|
|
@echo "Running test sysvmatch"
|
|
|
|
@${MAKE} sysvmatch || ${MAKE} failure
|
|
|
|
@echo "PASS: Test sysvmatch detected no regression."
|
2002-06-19 18:57:04 +00:00
|
|
|
@echo "Running test lhs_expn"
|
2002-06-20 03:08:20 +00:00
|
|
|
@! ${MAKE} lhs_expn && true || ${MAKE} failure
|
2002-06-19 18:57:04 +00:00
|
|
|
@echo "PASS: Test lhs_expn detected no regression."
|
2002-11-28 13:08:09 +00:00
|
|
|
@echo "Running test notdef"
|
|
|
|
@${MAKE} notdef || ${MAKE} failure
|
|
|
|
@echo "PASS: Test notdef detected no regression."
|
|
|
|
@echo "Running test modifiers"
|
|
|
|
@${MAKE} modifiers || ${MAKE} failure
|
|
|
|
@echo "PASS: Test modifiers detected no regression."
|
2002-11-28 13:21:32 +00:00
|
|
|
@echo "Running test funny_targets"
|
|
|
|
@${MAKE} funny_targets || ${MAKE} failure
|
|
|
|
@echo "PASS: Test funny_targets detected no regression."
|
2002-04-21 00:41:37 +00:00
|
|
|
|
2002-10-25 06:17:44 +00:00
|
|
|
.if make(double)
|
2002-07-28 03:57:08 +00:00
|
|
|
# Doubly-defined targets. make(1) will warn, but use the "right" one. If it
|
|
|
|
# switches to using the "non-right" one, it breaks things worse than a little
|
|
|
|
# regression test.
|
2002-04-21 00:41:37 +00:00
|
|
|
double:
|
|
|
|
@true
|
|
|
|
|
|
|
|
double:
|
|
|
|
@false
|
2002-10-25 06:17:44 +00:00
|
|
|
.endif
|
2002-04-20 20:57:00 +00:00
|
|
|
|
2002-10-25 06:17:44 +00:00
|
|
|
.if make(sysvmatch)
|
2002-05-05 19:02:30 +00:00
|
|
|
# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst.
|
|
|
|
sysvmatch:
|
|
|
|
@echo EMPTY ${NIL:=foo} LHS | \
|
|
|
|
diff -u ${.CURDIR}/regress.sysvmatch.out - || false
|
2002-10-25 06:17:44 +00:00
|
|
|
.endif
|
2002-05-05 19:02:30 +00:00
|
|
|
|
2002-06-19 18:57:04 +00:00
|
|
|
# A bogus target for the lhs_expn test; If this is reached, then the make(1)
|
|
|
|
# program has not errored out because of the recursion caused by not expanding
|
|
|
|
# the left-hand-side's embedded variables above.
|
|
|
|
lhs_expn:
|
2002-06-20 03:08:20 +00:00
|
|
|
@true
|
2002-06-19 18:57:04 +00:00
|
|
|
|
2002-11-28 13:08:09 +00:00
|
|
|
.if make(notdef)
|
|
|
|
# make(1) claims to only evaluate a conditional as far as is necessary
|
|
|
|
# to determine its value; that was not always the case.
|
|
|
|
.undef notdef
|
|
|
|
notdef:
|
|
|
|
.if defined(notdef) && ${notdef:U}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if make(modifiers)
|
|
|
|
# See if make(1) supports the C modifier.
|
|
|
|
modifiers:
|
|
|
|
@if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \
|
|
|
|
grep -q "Unknown modifier 'C'"; then \
|
|
|
|
false; \
|
|
|
|
fi
|
|
|
|
.endif
|
|
|
|
|
2002-11-28 13:21:32 +00:00
|
|
|
.if make(funny_targets)
|
|
|
|
funny_targets: colons::target exclamation!target
|
|
|
|
colons::target:
|
|
|
|
exclamation!target:
|
|
|
|
.endif
|
|
|
|
|
2002-04-20 20:57:00 +00:00
|
|
|
failure:
|
2002-04-27 02:26:23 +00:00
|
|
|
@echo "FAIL: Test failed: regression detected. See above."
|
2002-04-20 20:57:00 +00:00
|
|
|
@false
|