Makefile revision 21038
1193323Sed#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
2193323Sed#	$Id: Makefile,v 1.45 1996/10/17 18:44:56 jkh Exp $
3193323Sed#
4193323Sed# Doing a make install builds /usr/include
5193323Sed#
6193323Sed# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
7193323Sed# links.
8193323Sed#
9193323Sedall depend lint tags:
10193323Sed
11193323SedCLEANFILES= osreldate.h version vers.c
12193323SedSUBDIR= rpcsvc
13193323SedFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
14193323Sed	err.h f2c.h fnmatch.h fstab.h fts.h glob.h grp.h strhash.h histedit.h \
15193323Sed	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h ndbm.h \
16193323Sed	netdb.h nl_types.h nlist.h paths.h pthread.h pthread_np.h pwd.h \
17193323Sed	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
18193323Sed	signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
19193323Sed	struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h utime.h \
20193323Sed	utmp.h vis.h
21193323Sed.if defined(WANT_CSRG_LIBM)
22193323SedFILES+=	math.h
23193323Sed.endif
24193323Sed
25193323SedARPAFILES=	ftp.h inet.h nameser.h telnet.h tftp.h
26193323Sed
27193323SedPROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
28193323Sed
29193323SedRPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
30193323Sed		rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
31193323Sed
32193323SedMFILES=	float.h floatingpoint.h stdarg.h varargs.h
33193323SedLFILES=	errno.h fcntl.h syslog.h termios.h
34193323Sed
35193323SedLDIRS=	net netns netatalk netinet netipx netkey nfs pccard sys vm \
36193323Sed		# netccitt netiso
37193323Sed
38193323SedLUDIR=	ufs
39193323SedUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
40193323Sed
41193323Sed# Define SHARED to indicate whether you want symbolic links to the system
42193323Sed# source (``symlinks''), or a separate copy (``copies''); (latter useful
43193323Sed# in environments where it's not possible to keep /sys publicly readable)
44193323Sed# SHARED=	copies
45193323SedSHARED?=	symlinks
46193323Sed
47193323Sedbeforeinstall: ${SHARED}
48193323Sed	cd ${.CURDIR}; \
49193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
50193323Sed		${FILES} ${DESTDIR}/usr/include
51193323Sed	cd ${.CURDIR}/arpa; \
52193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
53193323Sed		${ARPAFILES} ${DESTDIR}/usr/include/arpa
54193323Sed	cd ${.CURDIR}/protocols; \
55193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
56193323Sed		${PROTOFILES} ${DESTDIR}/usr/include/protocols
57193323Sed	cd ${.CURDIR}/rpc; \
58193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
59193323Sed		${RPCFILES} ${DESTDIR}/usr/include/rpc
60193323Sed	@rm -f osreldate.h
61193323Sed.if exists (${.CURDIR}/../sys/conf/newvers.sh)
62193323Sed	@${ECHO} creating osreldate.h from newvers.sh
63193323Sed	. ${.CURDIR}/../sys/conf/newvers.sh;			\
64193323Sed	echo "$$COPYRIGHT" > osreldate.h;			\
65193323Sed	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
66193323Sed	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
67193323Sed.else
68193323Sed	@${ECHO} creating osreldate.h from sysctl info
69199511Srdivacky	@echo \#'undef __FreeBSD_version' > osreldate.h
70199511Srdivacky	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
71199511Srdivacky		>> osreldate.h
72199511Srdivacky.endif
73199511Srdivacky	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 osreldate.h \
74193323Sed		${DESTDIR}/usr/include
75193323Sed.for i in ${LFILES}
76193323Sed	ln -sf sys/$i ${DESTDIR}/usr/include/$i
77193323Sed.endfor
78193323Sed.for i in ${MFILES}
79193323Sed	ln -sf machine/$i ${DESTDIR}/usr/include/$i
80193323Sed.endfor
81193323Sed
82193323Sedcopies:
83193323Sed.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
84193323Sed	if [ -h ${DESTDIR}/usr/include/$i ]; then \
85193323Sed		rm -f ${DESTDIR}/usr/include/$i; \
86193323Sed	fi
87193323Sed.endfor
88193323Sed.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
89193323Sed	if [ ! -d ${DESTDIR}/usr/include/$i ]; then \
90193323Sed		mkdir ${DESTDIR}/usr/include/$i; \
91193323Sed		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$i; \
92193323Sed		chmod 755 ${DESTDIR}/usr/include/$i; \
93193323Sed	fi
94193323Sed.endfor
95193323Sed.for i in ${LDIRS} ${UDIRS}
96193323Sed	cd ${.CURDIR}/../sys; \
97193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
98193323Sed		${DESTDIR}/usr/include/$i
99193323Sed.endfor
100193323Sed.if exists(${.CURDIR}/../sys/${MACHINE}/include)
101193323Sed	cd ${.CURDIR}/../sys/${MACHINE}/include; \
102193323Sed		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
103193323Sed		${DESTDIR}/usr/include/machine
104193323Sed.endif
105193323Sed
106193323Sedsymlinks:
107193323Sed	@${ECHO} "Setting up symlinks to kernel source tree..."
108193323Sed.for i in ${LDIRS} ${LUDIR}
109193323Sed	rm -rf ${DESTDIR}/usr/include/$i
110193323Sed	ln -s ${DESTDIR}/sys/$i ${DESTDIR}/usr/include/$i
111193323Sed.endfor
112193323Sed	rm -rf ${DESTDIR}/usr/include/machine
113193323Sed	ln -s ${DESTDIR}/sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
114193323Sed
115193323Sed.include <bsd.prog.mk>
116193323Sed