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