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