Makefile revision 107375
195158Sjmallett# $FreeBSD: head/tools/build/make_check/Makefile 107375 2002-11-28 13:21:32Z ru $ 295158Sjmallett 398442Sjmallett# Test for broken LHS expansion. 4107374Sru# This *must* cause make(1) to detect a recursive variable, and fail as such. 598442Sjmallett.if make(lhs_expn) 698442SjmallettFOO= ${BAR} 798442SjmallettBAR${NIL}= ${FOO} 898442SjmallettFOO${BAR}= ${FOO} 998442Sjmallett.endif 1098442Sjmallett 1195158SjmallettDATA1= helllo 1295158SjmallettDATA2:= ${DATA1} 1395158SjmallettDATA3= ${DATA2:S/ll/rr/g} 1495158SjmallettDATA4:= ${DATA2:S/ll/rr/g} 1595158SjmallettDATA2?= allo 1695158SjmallettDATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} 1795158SjmallettDATA2= yello 1895158SjmallettDATA1:= ${DATA5:S/l/r/g} 1996070SjmallettNIL= 2095158Sjmallett 2195158Sjmallettall: 2295158Sjmallett @echo "Running test variables" 2395158Sjmallett @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ 2495158Sjmallett diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure 2595538Sjmallett @echo "PASS: Test variables detected no regression, output matches." 2695167Sjmallett @echo "Running test targets" 2795167Sjmallett @${MAKE} double || ${MAKE} failure 2895538Sjmallett @echo "PASS: Test targets detected no regression." 2996070Sjmallett @echo "Running test sysvmatch" 3096070Sjmallett @${MAKE} sysvmatch || ${MAKE} failure 3196070Sjmallett @echo "PASS: Test sysvmatch detected no regression." 3298442Sjmallett @echo "Running test lhs_expn" 3398461Sjmallett @! ${MAKE} lhs_expn && true || ${MAKE} failure 3498442Sjmallett @echo "PASS: Test lhs_expn detected no regression." 35107374Sru @echo "Running test notdef" 36107374Sru @${MAKE} notdef || ${MAKE} failure 37107374Sru @echo "PASS: Test notdef detected no regression." 38107374Sru @echo "Running test modifiers" 39107374Sru @${MAKE} modifiers || ${MAKE} failure 40107374Sru @echo "PASS: Test modifiers detected no regression." 41107375Sru @echo "Running test funny_targets" 42107375Sru @${MAKE} funny_targets || ${MAKE} failure 43107375Sru @echo "PASS: Test funny_targets detected no regression." 4495158Sjmallett 45105907Sjmallett.if make(double) 46100794Sjmallett# Doubly-defined targets. make(1) will warn, but use the "right" one. If it 47100794Sjmallett# switches to using the "non-right" one, it breaks things worse than a little 48100794Sjmallett# regression test. 4995167Sjmallettdouble: 5095167Sjmallett @true 5195167Sjmallett 5295167Sjmallettdouble: 5395167Sjmallett @false 54105907Sjmallett.endif 5595167Sjmallett 56105907Sjmallett.if make(sysvmatch) 5796070Sjmallett# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. 5896070Sjmallettsysvmatch: 5996070Sjmallett @echo EMPTY ${NIL:=foo} LHS | \ 6096070Sjmallett diff -u ${.CURDIR}/regress.sysvmatch.out - || false 61105907Sjmallett.endif 6296070Sjmallett 6398442Sjmallett# A bogus target for the lhs_expn test; If this is reached, then the make(1) 6498442Sjmallett# program has not errored out because of the recursion caused by not expanding 6598442Sjmallett# the left-hand-side's embedded variables above. 6698442Sjmallettlhs_expn: 6798461Sjmallett @true 6898442Sjmallett 69107374Sru.if make(notdef) 70107374Sru# make(1) claims to only evaluate a conditional as far as is necessary 71107374Sru# to determine its value; that was not always the case. 72107374Sru.undef notdef 73107374Srunotdef: 74107374Sru.if defined(notdef) && ${notdef:U} 75107374Sru.endif 76107374Sru.endif 77107374Sru 78107374Sru.if make(modifiers) 79107374Sru# See if make(1) supports the C modifier. 80107374Srumodifiers: 81107374Sru @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ 82107374Sru grep -q "Unknown modifier 'C'"; then \ 83107374Sru false; \ 84107374Sru fi 85107374Sru.endif 86107374Sru 87107375Sru.if make(funny_targets) 88107375Srufunny_targets: colons::target exclamation!target 89107375Srucolons::target: 90107375Sruexclamation!target: 91107375Sru.endif 92107375Sru 9395158Sjmallettfailure: 9495538Sjmallett @echo "FAIL: Test failed: regression detected. See above." 9595158Sjmallett @false 96