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