1 # $NetBSD: Makefile,v 1.18 2003/09/30 04:20:24 mycroft Exp $ 2 3 NOMAN= # defined 4 LDSTATIC= -static # only static compilation makes sense here 5 6 PROG= doexec 7 8 .include <bsd.own.mk> # May define DESTDIR in mk.conf.. 9 .if defined(DESTDIR) 10 LDLIBS+= -lgcc -lc -lgcc ${LIBCRTEND} 11 GOODAOUT_LIB= -nostdlib -L${DESTDIR}/usr/lib ${LDSTATIC} \ 12 ${LIBCRT0} ${LIBCRTBEGIN} 13 .else 14 GOODAOUT_LIB= ${LDSTATIC} 15 .endif 16 17 RP= ./${PROG} 18 TD= ${.CURDIR}/tests 19 OD= ${.CURDIR}/good 20 21 TESTSCRIPTS= empty nonexistshell devnullscript badinterplen goodscript \ 22 scriptarg scriptarg-nospace 23 24 all: ${PROG} goodaout truncaout ${TESTSCRIPTS} 25 26 .for x in ${TESTSCRIPTS} 27 ${x}: ${TD}/${x} 28 cp ${TD}/${x} . 29 chmod +x ${x} 30 .endfor 31 32 CLEANFILES+= goodaout truncaout ${TESTSCRIPTS} 33 34 regress: test-empty test-nonexist \ 35 test-nonexistshell test-devnullscript test-badinterplen \ 36 test-goodscript test-scriptarg test-scriptarg-nospace \ 37 test-goodaout test-truncaout 38 39 test-empty: ${PROG} empty 40 ${RP} empty | diff ${OD}/empty - 41 42 test-nonexist: ${PROG} 43 ${RP} ${TD}/nonexistent | diff ${OD}/nonexistent - 44 45 test-nonexistshell: ${PROG} nonexistshell 46 ${RP} nonexistshell | diff ${OD}/nonexistshell - 47 48 test-devnullscript: ${PROG} devnullscript 49 ${RP} devnullscript | diff ${OD}/devnullscript - 50 51 test-badinterplen: ${PROG} badinterplen 52 ${RP} badinterplen | diff ${OD}/badinterplen - 53 54 test-goodscript: ${PROG} goodscript 55 ${RP} goodscript | diff ${OD}/goodscript - 56 57 test-scriptarg: ${PROG} scriptarg 58 ${RP} scriptarg 2>&1 | diff ${OD}/scriptarg - 59 60 test-scriptarg-nospace: ${PROG} scriptarg-nospace 61 ${RP} scriptarg-nospace 2>&1 | diff ${OD}/scriptarg-nospace - 62 63 goodaout: ${TD}/goodaout.c 64 ${LINK.c} ${GOODAOUT_LIB} -o ${.TARGET} ${TD}/goodaout.c ${LDLIBS} 65 66 test-goodaout: ${PROG} goodaout 67 ${RP} goodaout | diff ${OD}/goodaout - 68 69 truncaout: goodaout 70 /bin/rm -rf truncaout 71 dd if=goodaout of=truncaout bs=16 count=1 72 chmod a+x truncaout 73 74 test-truncaout: ${PROG} truncaout 75 ${RP} truncaout | diff ${OD}/truncaout - 76 77 .include <bsd.prog.mk> 78