Makefile revision 125219
195158Sjmallett# $FreeBSD: head/tools/build/make_check/Makefile 125219 2004-01-29 22:51:36Z 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" 27110654Sgad @${MAKE} double 2>/dev/null || ${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." 44117226Sru @echo "Running test arith_expr" 45117226Sru @${MAKE} arith_expr || ${MAKE} failure 46117226Sru @echo "PASS: Test arith_expr detected no regression." 47120676Sru @echo "Running test PATH_exists" 48120676Sru @${MAKE} PATH_exists || ${MAKE} failure 49120676Sru @echo "PASS: Test PATH_exists detected no regression." 50125219Sru @echo "Running test double_quotes" 51125219Sru @${MAKE} double_quotes || ${MAKE} failure 52125219Sru @echo "PASS: Test double_quotes detected no regression." 5395158Sjmallett 54105907Sjmallett.if make(double) 55100794Sjmallett# Doubly-defined targets. make(1) will warn, but use the "right" one. If it 56100794Sjmallett# switches to using the "non-right" one, it breaks things worse than a little 57100794Sjmallett# regression test. 5895167Sjmallettdouble: 5995167Sjmallett @true 6095167Sjmallett 6195167Sjmallettdouble: 6295167Sjmallett @false 63105907Sjmallett.endif 6495167Sjmallett 65105907Sjmallett.if make(sysvmatch) 6696070Sjmallett# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. 6796070Sjmallettsysvmatch: 6896070Sjmallett @echo EMPTY ${NIL:=foo} LHS | \ 6996070Sjmallett diff -u ${.CURDIR}/regress.sysvmatch.out - || false 70105907Sjmallett.endif 7196070Sjmallett 7298442Sjmallett# A bogus target for the lhs_expn test; If this is reached, then the make(1) 7398442Sjmallett# program has not errored out because of the recursion caused by not expanding 7498442Sjmallett# the left-hand-side's embedded variables above. 7598442Sjmallettlhs_expn: 7698461Sjmallett @true 7798442Sjmallett 78107374Sru.if make(notdef) 79107374Sru# make(1) claims to only evaluate a conditional as far as is necessary 80107374Sru# to determine its value; that was not always the case. 81107374Sru.undef notdef 82107374Srunotdef: 83107374Sru.if defined(notdef) && ${notdef:U} 84107374Sru.endif 85107374Sru.endif 86107374Sru 87107374Sru.if make(modifiers) 88107374Sru# See if make(1) supports the C modifier. 89107374Srumodifiers: 90107374Sru @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ 91107374Sru grep -q "Unknown modifier 'C'"; then \ 92107374Sru false; \ 93107374Sru fi 94107374Sru.endif 95107374Sru 96107375Sru.if make(funny_targets) 97107375Srufunny_targets: colons::target exclamation!target 98107375Srucolons::target: 99107375Sruexclamation!target: 100107375Sru.endif 101107375Sru 102117226Sru.if make(arith_expr) 103117226Sruarith_expr: 104117226Sru# See if arithmetic expression parsing is broken. 105117226Sru# The different spacing below is intentional. 106117226SruVALUE= 0 107117226Sru.if (${VALUE} < 0)||(${VALUE}>0) 108117226Sru.endif 109117226Sru.endif 110117226Sru 111120676Sru.if make(PATH_exists) 112120676SruPATH_exists: 113120676Sru.PATH: ${.CURDIR} 114120676Sru.if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) 115120676Sru.error exists() failed 116120676Sru.endif 117120676Sru.endif 118120676Sru 119125219Sru.if make(double_quotes) 120125219SruVALUE= foo "" 121125219Srudouble_quotes: 122125219Sru.if ${VALUE:S/$//} != ${VALUE} 123125219Sru.error "" reduced to " 124125219Sru.endif 125125219Sru.endif 126125219Sru 12795158Sjmallettfailure: 12895538Sjmallett @echo "FAIL: Test failed: regression detected. See above." 12995158Sjmallett @false 130