1 # $NetBSD: Makefile,v 1.12 1999/08/01 13:42:00 sommerfeld Exp $ 2 3 PROG= doexec 4 MKMAN= no 5 6 LDSTATIC= -static # only static compilation makes sense here 7 8 .include <bsd.own.mk> # May define DESTDIR in mk.conf.. 9 .if defined(DESTDIR) 10 LDLIBS+= -lgcc -lc ${LIBCRTEND} 11 GOODAOUT_LIB= -nostdlib -L${DESTDIR}/usr/lib ${LDSTATIC} 12 GOODAOUT_LIB+= ${LIBCRT0} ${LIBCRTBEGIN} 13 .else 14 GOODAOUT_LIB= ${LDSTATIC} 15 .endif 16 17 RP= ${.OBJDIR}/${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} ${.OBJDIR} 29 chmod +x ${.OBJDIR}/${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 empty: ${TD}/empty 40 cp ${TD}/empty ${.OBJDIR}/empty 41 chmod +x ${.OBJDIR}/empty 42 43 test-empty: ${PROG} empty 44 ${RP} ${.OBJDIR}/empty | diff - ${OD}/empty 45 46 test-nonexist: ${PROG} 47 ${RP} ${TD}/nonexistent | diff - ${OD}/nonexistent 48 49 test-nonexistshell: ${PROG} nonexistshell 50 ${RP} ${.OBJDIR}/nonexistshell | diff - ${OD}/nonexistshell 51 52 test-devnullscript: ${PROG} devnullscript 53 ${RP} ${.OBJDIR}/devnullscript | diff - ${OD}/devnullscript 54 55 test-badinterplen: ${PROG} badinterplen 56 ${RP} ${.OBJDIR}/badinterplen | diff - ${OD}/badinterplen 57 58 test-goodscript: ${PROG} goodscript 59 ${RP} ${.OBJDIR}/goodscript | diff - ${OD}/goodscript 60 61 test-scriptarg: ${PROG} scriptarg 62 ${RP} ${.OBJDIR}/scriptarg 2>&1 | diff - ${OD}/scriptarg 63 64 test-scriptarg-nospace: ${PROG} scriptarg-nospace 65 ${RP} ${.OBJDIR}/scriptarg-nospace 2>&1 | diff - ${OD}/scriptarg-nospace 66 67 goodaout: ${TD}/goodaout.c 68 ${LINK.c} ${GOODAOUT_LIB} -o ${.TARGET} ${TD}/goodaout.c ${LDLIBS} 69 70 test-goodaout: ${PROG} goodaout 71 ${RP} ${.OBJDIR}/goodaout | diff - ${OD}/goodaout 72 73 truncaout: goodaout 74 /bin/rm -rf truncaout 75 dd if=${.OBJDIR}/goodaout of=truncaout bs=16 count=1 76 chmod a+x truncaout 77 78 test-truncaout: ${PROG} truncaout 79 ${RP} ${.OBJDIR}/truncaout | diff - ${OD}/truncaout 80 81 .include <bsd.prog.mk> 82