Makefile revision 120676
195158Sjmallett# $FreeBSD: head/tools/build/make_check/Makefile 120676 2003-10-02 21:30:30Z 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." 5095158Sjmallett 51105907Sjmallett.if make(double) 52100794Sjmallett# Doubly-defined targets. make(1) will warn, but use the "right" one. If it 53100794Sjmallett# switches to using the "non-right" one, it breaks things worse than a little 54100794Sjmallett# regression test. 5595167Sjmallettdouble: 5695167Sjmallett @true 5795167Sjmallett 5895167Sjmallettdouble: 5995167Sjmallett @false 60105907Sjmallett.endif 6195167Sjmallett 62105907Sjmallett.if make(sysvmatch) 6396070Sjmallett# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. 6496070Sjmallettsysvmatch: 6596070Sjmallett @echo EMPTY ${NIL:=foo} LHS | \ 6696070Sjmallett diff -u ${.CURDIR}/regress.sysvmatch.out - || false 67105907Sjmallett.endif 6896070Sjmallett 6998442Sjmallett# A bogus target for the lhs_expn test; If this is reached, then the make(1) 7098442Sjmallett# program has not errored out because of the recursion caused by not expanding 7198442Sjmallett# the left-hand-side's embedded variables above. 7298442Sjmallettlhs_expn: 7398461Sjmallett @true 7498442Sjmallett 75107374Sru.if make(notdef) 76107374Sru# make(1) claims to only evaluate a conditional as far as is necessary 77107374Sru# to determine its value; that was not always the case. 78107374Sru.undef notdef 79107374Srunotdef: 80107374Sru.if defined(notdef) && ${notdef:U} 81107374Sru.endif 82107374Sru.endif 83107374Sru 84107374Sru.if make(modifiers) 85107374Sru# See if make(1) supports the C modifier. 86107374Srumodifiers: 87107374Sru @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ 88107374Sru grep -q "Unknown modifier 'C'"; then \ 89107374Sru false; \ 90107374Sru fi 91107374Sru.endif 92107374Sru 93107375Sru.if make(funny_targets) 94107375Srufunny_targets: colons::target exclamation!target 95107375Srucolons::target: 96107375Sruexclamation!target: 97107375Sru.endif 98107375Sru 99117226Sru.if make(arith_expr) 100117226Sruarith_expr: 101117226Sru# See if arithmetic expression parsing is broken. 102117226Sru# The different spacing below is intentional. 103117226SruVALUE= 0 104117226Sru.if (${VALUE} < 0)||(${VALUE}>0) 105117226Sru.endif 106117226Sru.endif 107117226Sru 108120676Sru.if make(PATH_exists) 109120676SruPATH_exists: 110120676Sru.PATH: ${.CURDIR} 111120676Sru.if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) 112120676Sru.error exists() failed 113120676Sru.endif 114120676Sru.endif 115120676Sru 11695158Sjmallettfailure: 11795538Sjmallett @echo "FAIL: Test failed: regression detected. See above." 11895158Sjmallett @false 119