16541d27cSJuli Mallett# $FreeBSD$ 26541d27cSJuli Mallett 30aa9e01cSJuli Mallett# Test for broken LHS expansion. 4113cf9e6SRuslan Ermilov# This *must* cause make(1) to detect a recursive variable, and fail as such. 50aa9e01cSJuli Mallett.if make(lhs_expn) 60aa9e01cSJuli MallettFOO= ${BAR} 70aa9e01cSJuli MallettBAR${NIL}= ${FOO} 80aa9e01cSJuli MallettFOO${BAR}= ${FOO} 90aa9e01cSJuli Mallett.endif 100aa9e01cSJuli Mallett 116541d27cSJuli MallettDATA1= helllo 126541d27cSJuli MallettDATA2:= ${DATA1} 136541d27cSJuli MallettDATA3= ${DATA2:S/ll/rr/g} 146541d27cSJuli MallettDATA4:= ${DATA2:S/ll/rr/g} 156541d27cSJuli MallettDATA2?= allo 166541d27cSJuli MallettDATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} 176541d27cSJuli MallettDATA2= yello 186541d27cSJuli MallettDATA1:= ${DATA5:S/l/r/g} 19a9b736adSJuli MallettNIL= 206541d27cSJuli Mallett 216541d27cSJuli Mallettall: 226541d27cSJuli Mallett @echo "Running test variables" 236541d27cSJuli Mallett @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ 246541d27cSJuli Mallett diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure 25624abf85SJuli Mallett @echo "PASS: Test variables detected no regression, output matches." 266d3ca9deSJuli Mallett @echo "Running test targets" 276d3ca9deSJuli Mallett @${MAKE} double || ${MAKE} failure 28624abf85SJuli Mallett @echo "PASS: Test targets detected no regression." 29a9b736adSJuli Mallett @echo "Running test sysvmatch" 30a9b736adSJuli Mallett @${MAKE} sysvmatch || ${MAKE} failure 31a9b736adSJuli Mallett @echo "PASS: Test sysvmatch detected no regression." 320aa9e01cSJuli Mallett @echo "Running test lhs_expn" 336d5fda5fSJuli Mallett @! ${MAKE} lhs_expn && true || ${MAKE} failure 340aa9e01cSJuli Mallett @echo "PASS: Test lhs_expn detected no regression." 35113cf9e6SRuslan Ermilov @echo "Running test notdef" 36113cf9e6SRuslan Ermilov @${MAKE} notdef || ${MAKE} failure 37113cf9e6SRuslan Ermilov @echo "PASS: Test notdef detected no regression." 38113cf9e6SRuslan Ermilov @echo "Running test modifiers" 39113cf9e6SRuslan Ermilov @${MAKE} modifiers || ${MAKE} failure 40113cf9e6SRuslan Ermilov @echo "PASS: Test modifiers detected no regression." 416d3ca9deSJuli Mallett 425661d4a7SJuli Mallett.if make(double) 4389d22e2fSJuli Mallett# Doubly-defined targets. make(1) will warn, but use the "right" one. If it 4489d22e2fSJuli Mallett# switches to using the "non-right" one, it breaks things worse than a little 4589d22e2fSJuli Mallett# regression test. 466d3ca9deSJuli Mallettdouble: 476d3ca9deSJuli Mallett @true 486d3ca9deSJuli Mallett 496d3ca9deSJuli Mallettdouble: 506d3ca9deSJuli Mallett @false 515661d4a7SJuli Mallett.endif 526541d27cSJuli Mallett 535661d4a7SJuli Mallett.if make(sysvmatch) 54a9b736adSJuli Mallett# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. 55a9b736adSJuli Mallettsysvmatch: 56a9b736adSJuli Mallett @echo EMPTY ${NIL:=foo} LHS | \ 57a9b736adSJuli Mallett diff -u ${.CURDIR}/regress.sysvmatch.out - || false 585661d4a7SJuli Mallett.endif 59a9b736adSJuli Mallett 600aa9e01cSJuli Mallett# A bogus target for the lhs_expn test; If this is reached, then the make(1) 610aa9e01cSJuli Mallett# program has not errored out because of the recursion caused by not expanding 620aa9e01cSJuli Mallett# the left-hand-side's embedded variables above. 630aa9e01cSJuli Mallettlhs_expn: 646d5fda5fSJuli Mallett @true 650aa9e01cSJuli Mallett 66113cf9e6SRuslan Ermilov.if make(notdef) 67113cf9e6SRuslan Ermilov# make(1) claims to only evaluate a conditional as far as is necessary 68113cf9e6SRuslan Ermilov# to determine its value; that was not always the case. 69113cf9e6SRuslan Ermilov.undef notdef 70113cf9e6SRuslan Ermilovnotdef: 71113cf9e6SRuslan Ermilov.if defined(notdef) && ${notdef:U} 72113cf9e6SRuslan Ermilov.endif 73113cf9e6SRuslan Ermilov.endif 74113cf9e6SRuslan Ermilov 75113cf9e6SRuslan Ermilov.if make(modifiers) 76113cf9e6SRuslan Ermilov# See if make(1) supports the C modifier. 77113cf9e6SRuslan Ermilovmodifiers: 78113cf9e6SRuslan Ermilov @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ 79113cf9e6SRuslan Ermilov grep -q "Unknown modifier 'C'"; then \ 80113cf9e6SRuslan Ermilov false; \ 81113cf9e6SRuslan Ermilov fi 82113cf9e6SRuslan Ermilov.endif 83113cf9e6SRuslan Ermilov 846541d27cSJuli Mallettfailure: 85624abf85SJuli Mallett @echo "FAIL: Test failed: regression detected. See above." 866541d27cSJuli Mallett @false 87