Makefile revision 125227
12061Sjkh# $FreeBSD: head/tools/build/make_check/Makefile 125227 2004-01-30 09:46:28Z ru $ 236622Scharnier 32061Sjkh# Test for broken LHS expansion. 433611Sjb# This *must* cause make(1) to detect a recursive variable, and fail as such. 532427Sjb.if make(lhs_expn) 632427SjbFOO= ${BAR} 736111SjbBAR${NIL}= ${FOO} 833611SjbFOO${BAR}= ${FOO} 932427Sjb.endif 1032427Sjb 112061SjkhDATA1= helllo 1215603SmarkmDATA2:= ${DATA1} 1330169SjkhDATA3= ${DATA2:S/ll/rr/g} 1420710SasamiDATA4:= ${DATA2:S/ll/rr/g} 1520710SasamiDATA2?= allo 163197ScsgrDATA5:= ${DATA2:S/ll/ii/g} ${DATA1:S/ll/rr/g} 172061SjkhDATA2= yello 1812483SpeterDATA1:= ${DATA5:S/l/r/g} 1934509SbdeNIL= 202160Scsgr 212834Swollmanall: 222061Sjkh @echo "Running test variables" 232061Sjkh @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ 242160Scsgr diff -u ${.CURDIR}/regress.variables.out - || ${MAKE} failure 2517308Speter @echo "PASS: Test variables detected no regression, output matches." 2619320Sadam @echo "Running test targets" 2727788Sasami @${MAKE} double 2>/dev/null || ${MAKE} failure 2830169Sjkh @echo "PASS: Test targets detected no regression." 2925980Sasami @echo "Running test sysvmatch" 301594Srgrimes @${MAKE} sysvmatch || ${MAKE} failure 3117308Speter @echo "PASS: Test sysvmatch detected no regression." 3217308Speter @echo "Running test lhs_expn" 3327910Sasami @! ${MAKE} lhs_expn && true || ${MAKE} failure 3427910Sasami @echo "PASS: Test lhs_expn detected no regression." 3527910Sasami @echo "Running test notdef" 3617308Speter @${MAKE} notdef || ${MAKE} failure 3717308Speter @echo "PASS: Test notdef detected no regression." 3817308Speter @echo "Running test modifiers" 3919175Sbde @${MAKE} modifiers || ${MAKE} failure 4019175Sbde @echo "PASS: Test modifiers detected no regression." 4119175Sbde @echo "Running test funny_targets" 4219175Sbde @${MAKE} funny_targets || ${MAKE} failure 4317308Speter @echo "PASS: Test funny_targets detected no regression." 4427910Sasami @echo "Running test arith_expr" 4534509Sbde @${MAKE} arith_expr || ${MAKE} failure 4627910Sasami @echo "PASS: Test arith_expr detected no regression." 4717308Speter @echo "Running test PATH_exists" 482061Sjkh @${MAKE} PATH_exists || ${MAKE} failure 492061Sjkh @echo "PASS: Test PATH_exists detected no regression." 501594Srgrimes @echo "Running test double_quotes" 5130169Sjkh @${MAKE} double_quotes || ${MAKE} failure 5230169Sjkh @echo "PASS: Test double_quotes detected no regression." 5330169Sjkh @echo "Running test double_quotes2" 5430169Sjkh @! ${MAKE} double_quotes2 >/dev/null 2>&1 && true || ${MAKE} failure 5530169Sjkh @echo "PASS: Test double_quotes2 detected no regression." 5630169Sjkh 5730169Sjkh.if make(double) 5830169Sjkh# Doubly-defined targets. make(1) will warn, but use the "right" one. If it 597407Srgrimes# switches to using the "non-right" one, it breaks things worse than a little 607108Sphk# regression test. 617108Sphkdouble: 627108Sphk @true 637407Srgrimes 647407Srgrimesdouble: 657407Srgrimes @false 667108Sphk.endif 672061Sjkh 682061Sjkh.if make(sysvmatch) 692061Sjkh# Some versions of FreeBSD make(1) do not handle a nil LHS in sysvsubst. 7017308Spetersysvmatch: 712061Sjkh @echo EMPTY ${NIL:=foo} LHS | \ 722061Sjkh diff -u ${.CURDIR}/regress.sysvmatch.out - || false 732061Sjkh.endif 742061Sjkh 752061Sjkh# A bogus target for the lhs_expn test; If this is reached, then the make(1) 7635427Sbde# program has not errored out because of the recursion caused by not expanding 7735427Sbde# the left-hand-side's embedded variables above. 7830169Sjkhlhs_expn: 792626Scsgr @true 802061Sjkh 812061Sjkh.if make(notdef) 822061Sjkh# make(1) claims to only evaluate a conditional as far as is necessary 832061Sjkh# to determine its value; that was not always the case. 842061Sjkh.undef notdef 852061Sjkhnotdef: 8619320Sadam.if defined(notdef) && ${notdef:U} 872061Sjkh.endif 882061Sjkh.endif 892061Sjkh 902061Sjkh.if make(modifiers) 912061Sjkh# See if make(1) supports the C modifier. 922061Sjkhmodifiers: 932061Sjkh @if ${MAKE} -V .CURDIR:C/.// 2>&1 >/dev/null | \ 942061Sjkh grep -q "Unknown modifier 'C'"; then \ 952061Sjkh false; \ 962061Sjkh fi 972061Sjkh.endif 982834Swollman 992834Swollman.if make(funny_targets) 1002834Swollmanfunny_targets: colons::target exclamation!target 1012834Swollmancolons::target: 1022834Swollmanexclamation!target: 1032834Swollman.endif 1041594Srgrimes 1054486Sphk.if make(arith_expr) 1064486Sphkarith_expr: 1074486Sphk# See if arithmetic expression parsing is broken. 1084486Sphk# The different spacing below is intentional. 1094486SphkVALUE= 0 1102061Sjkh.if (${VALUE} < 0)||(${VALUE}>0) 1112061Sjkh.endif 11225979Sjkh.endif 11325979Sjkh 11425979Sjkh.if make(PATH_exists) 11525979SjkhPATH_exists: 1162061Sjkh.PATH: ${.CURDIR} 11725979Sjkh.if !exists(${.CURDIR}/) || !exists(${.CURDIR}/.) || !exists(${.CURDIR}/..) 1182061Sjkh.error exists() failed 1192061Sjkh.endif 12017308Speter.endif 1212061Sjkh 1222061Sjkh.if make(double_quotes) 1232061SjkhVALUE= foo "" 1242061Sjkhdouble_quotes: 1252061Sjkh.if ${VALUE:S/$//} != ${VALUE} 12612483Speter.error "" reduced to " 12712483Speter.endif 12812483Speter.endif 12912483Speter 1302061Sjkh.if make(double_quotes2) 13135479Sbdedouble_quotes2: 1328854Srgrimes @cat /dev/null "" 1332061Sjkh.endif 1342061Sjkh 13512483Speterfailure: 1362061Sjkh @echo "FAIL: Test failed: regression detected. See above." 13735479Sbde @false 13835479Sbde