11.18Smycroft#	$NetBSD: Makefile,v 1.18 2003/09/30 04:20:24 mycroft Exp $
21.1Scgd
31.16StvNOMAN=		# defined
41.16StvLDSTATIC=	-static		# only static compilation makes sense here
51.17Slukem
61.17SlukemPROG=		doexec
71.1Scgd
81.12Ssommerfe.include <bsd.own.mk>		# May define DESTDIR in mk.conf..
91.12Ssommerfe.if defined(DESTDIR)
101.16StvLDLIBS+=	-lgcc -lc -lgcc ${LIBCRTEND}
111.16StvGOODAOUT_LIB=	-nostdlib -L${DESTDIR}/usr/lib ${LDSTATIC} \
121.16Stv		${LIBCRT0} ${LIBCRTBEGIN}
131.7Swrstuden.else
141.16StvGOODAOUT_LIB=	${LDSTATIC}
151.7Swrstuden.endif
161.7Swrstuden
171.16StvRP=		./${PROG}
181.16StvTD=		${.CURDIR}/tests
191.16StvOD=		${.CURDIR}/good
201.1Scgd
211.16StvTESTSCRIPTS=	empty nonexistshell devnullscript badinterplen goodscript \
221.16Stv		scriptarg scriptarg-nospace
231.11Sis
241.16Stvall:		${PROG} goodaout truncaout ${TESTSCRIPTS}
251.11Sis
261.11Sis.for x in ${TESTSCRIPTS}
271.11Sis${x}: ${TD}/${x}
281.15Stv	cp ${TD}/${x} .
291.15Stv	chmod +x ${x}
301.11Sis.endfor
311.11Sis
321.16StvCLEANFILES+=	goodaout truncaout ${TESTSCRIPTS}
331.1Scgd
341.1Scgdregress:	test-empty test-nonexist \
351.1Scgd		test-nonexistshell test-devnullscript test-badinterplen \
361.1Scgd		test-goodscript test-scriptarg test-scriptarg-nospace \
371.1Scgd		test-goodaout test-truncaout
381.11Sis
391.11Sistest-empty:	${PROG} empty
401.18Smycroft	${RP} empty | diff ${OD}/empty -
411.1Scgd
421.1Scgdtest-nonexist:	${PROG}
431.18Smycroft	${RP} ${TD}/nonexistent | diff ${OD}/nonexistent -
441.1Scgd
451.11Sistest-nonexistshell: ${PROG} nonexistshell
461.18Smycroft	${RP} nonexistshell | diff ${OD}/nonexistshell -
471.1Scgd
481.11Sistest-devnullscript: ${PROG} devnullscript
491.18Smycroft	${RP} devnullscript | diff ${OD}/devnullscript -
501.1Scgd
511.11Sistest-badinterplen: ${PROG} badinterplen
521.18Smycroft	${RP} badinterplen | diff ${OD}/badinterplen -
531.1Scgd
541.11Sistest-goodscript: ${PROG} goodscript
551.18Smycroft	${RP} goodscript | diff ${OD}/goodscript -
561.1Scgd
571.11Sistest-scriptarg: ${PROG} scriptarg
581.18Smycroft	${RP} scriptarg 2>&1 | diff ${OD}/scriptarg -
591.1Scgd
601.11Sistest-scriptarg-nospace: ${PROG} scriptarg-nospace
611.18Smycroft	${RP} scriptarg-nospace 2>&1 | diff ${OD}/scriptarg-nospace -
621.1Scgd
631.1Scgdgoodaout: ${TD}/goodaout.c
641.7Swrstuden	${LINK.c} ${GOODAOUT_LIB} -o ${.TARGET} ${TD}/goodaout.c ${LDLIBS}
651.1Scgd
661.1Scgdtest-goodaout: ${PROG} goodaout
671.18Smycroft	${RP} goodaout | diff ${OD}/goodaout -
681.1Scgd
691.1Scgdtruncaout: goodaout
701.1Scgd	/bin/rm -rf truncaout
711.15Stv	dd if=goodaout of=truncaout bs=16 count=1
721.1Scgd	chmod a+x truncaout
731.3Sglass
741.1Scgdtest-truncaout: ${PROG} truncaout
751.18Smycroft	${RP} truncaout | diff ${OD}/truncaout -
761.1Scgd
771.1Scgd.include <bsd.prog.mk>
78