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