Makefile revision 1.14
1#	$NetBSD: Makefile,v 1.14 2001/01/14 06:35:57 christos 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
39test-empty:	${PROG} empty
40	${RP} ${.OBJDIR}/empty | diff - ${OD}/empty
41
42test-nonexist:	${PROG}
43	${RP} ${TD}/nonexistent | diff - ${OD}/nonexistent
44
45test-nonexistshell: ${PROG} nonexistshell
46	${RP} ${.OBJDIR}/nonexistshell | diff - ${OD}/nonexistshell
47
48test-devnullscript: ${PROG} devnullscript
49	${RP} ${.OBJDIR}/devnullscript | diff - ${OD}/devnullscript
50
51test-badinterplen: ${PROG} badinterplen
52	${RP} ${.OBJDIR}/badinterplen | diff - ${OD}/badinterplen
53
54test-goodscript: ${PROG} goodscript
55	${RP} ${.OBJDIR}/goodscript | diff - ${OD}/goodscript
56
57test-scriptarg: ${PROG} scriptarg
58	${RP} ${.OBJDIR}/scriptarg 2>&1 | diff - ${OD}/scriptarg
59
60test-scriptarg-nospace: ${PROG} scriptarg-nospace
61	${RP} ${.OBJDIR}/scriptarg-nospace 2>&1 | diff - ${OD}/scriptarg-nospace
62
63goodaout: ${TD}/goodaout.c
64	${LINK.c} ${GOODAOUT_LIB} -o ${.TARGET} ${TD}/goodaout.c ${LDLIBS}
65
66test-goodaout: ${PROG} goodaout
67	${RP} ${.OBJDIR}/goodaout | diff - ${OD}/goodaout
68
69truncaout: goodaout
70	/bin/rm -rf truncaout
71	dd if=${.OBJDIR}/goodaout of=truncaout bs=16 count=1
72	chmod a+x truncaout
73
74test-truncaout: ${PROG} truncaout
75	${RP} ${.OBJDIR}/truncaout | diff - ${OD}/truncaout
76
77.include <bsd.prog.mk>
78