Makefile revision 25734
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
225734Speter#	$Id: Makefile,v 1.54 1997/05/10 12:50:03 davidn Exp $
31539Srgrimes#
41539Srgrimes# Doing a make install builds /usr/include
51539Srgrimes#
61539Srgrimes# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
71539Srgrimes# links.
81539Srgrimes#
925734Speterdepend lint tags:
101539Srgrimes
1118420SbdeCLEANFILES= osreldate.h version vers.c
121833SwollmanSUBDIR= rpcsvc
131539SrgrimesFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
1425134Sasami	err.h fnmatch.h fstab.h fts.h glob.h grp.h strhash.h histedit.h \
1525659Sdavidn	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h \
1621306Ssos	ndbm.h netdb.h nl_types.h nlist.h paths.h pthread.h pthread_np.h pwd.h \
1717706Sjulian	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
1817706Sjulian	signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
1917706Sjulian	struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h utime.h \
201539Srgrimes	utmp.h vis.h
217242Sphk.if defined(WANT_CSRG_LIBM)
222573SbdeFILES+=	math.h
232573Sbde.endif
241539Srgrimes
2517900SpeterARPAFILES=	ftp.h inet.h nameser.h telnet.h tftp.h
2617900Speter
2717900SpeterPROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
2817900Speter
2917900SpeterRPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
3017900Speter		rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
3117900Speter
323329SbdeMFILES=	float.h floatingpoint.h stdarg.h varargs.h
331539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
341539Srgrimes
3523263SbdeLDIRS=	msdosfs net netns netatalk netinet netipx netkey nfs pccard sys vm \
3618999Sjkh		# netccitt netiso
3717900Speter
3823263SbdeLNOHEADERDIRS=	isofs ufs
3923263SbdeLSUBDIRS=	isofs/cd9660 ufs/ffs ufs/lfs ufs/mfs ufs/ufs
401539Srgrimes
411539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
421539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
431539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
441539Srgrimes# SHARED=	copies
451570SrgrimesSHARED?=	symlinks
461539Srgrimes
4725734Speter
4825734Speter.if exists (${.CURDIR}/../sys/conf/newvers.sh)
4925734Speterall:	osreldate.h
5025734Speter
5125734Speterosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh
5225734Speter	@${ECHO} creating osreldate.h from newvers.sh
5325734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
5425734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
5525734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
5625734Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
5725734Speter.else
5825734Speterall:
5925734Speter	@${ECHO} creating osreldate.h from sysctl info
6025734Speter	echo \#'undef __FreeBSD_version' > osreldate.h
6125734Speter	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
6225734Speter		>> osreldate.h
6325734Speter.endif
6425734Speter
651917Swollmanbeforeinstall: ${SHARED}
6617900Speter	cd ${.CURDIR}; \
6717900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
6817900Speter		${FILES} ${DESTDIR}/usr/include
6917900Speter	cd ${.CURDIR}/arpa; \
7017900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7117900Speter		${ARPAFILES} ${DESTDIR}/usr/include/arpa
7217900Speter	cd ${.CURDIR}/protocols; \
7317900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7417900Speter		${PROTOFILES} ${DESTDIR}/usr/include/protocols
7517992Sadam	cd ${.CURDIR}/rpc; \
7617992Sadam		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7717992Sadam		${RPCFILES} ${DESTDIR}/usr/include/rpc
7817900Speter	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 osreldate.h \
7917900Speter		${DESTDIR}/usr/include
8017900Speter.for i in ${LFILES}
8117900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
8217900Speter.endfor
8317900Speter.for i in ${MFILES}
8417900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
8517900Speter.endfor
861539Srgrimes
871539Srgrimescopies:
8823263Sbde.for i in ${LDIRS} ${LNOHEADERDIRS} machine
8917900Speter	if [ -h ${DESTDIR}/usr/include/$i ]; then \
9017900Speter		rm -f ${DESTDIR}/usr/include/$i; \
9117900Speter	fi
9217900Speter.endfor
9323566Sbde	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
9423566Sbde		-p ${DESTDIR}/usr/include
9523263Sbde.for i in ${LDIRS} ${LSUBDIRS}
9617900Speter	cd ${.CURDIR}/../sys; \
9717900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
9817900Speter		${DESTDIR}/usr/include/$i
9917900Speter.endfor
10017900Speter.if exists(${.CURDIR}/../sys/${MACHINE}/include)
10117900Speter	cd ${.CURDIR}/../sys/${MACHINE}/include; \
10217900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
10317900Speter		${DESTDIR}/usr/include/machine
10417900Speter.endif
1051539Srgrimes
1061539Srgrimessymlinks:
10717954Speter	@${ECHO} "Setting up symlinks to kernel source tree..."
10823263Sbde.for i in ${LDIRS} ${LNOHEADERDIRS}
10917954Speter	rm -rf ${DESTDIR}/usr/include/$i
11021044Sjkh	ln -s /sys/$i ${DESTDIR}/usr/include/$i
11117900Speter.endfor
11217954Speter	rm -rf ${DESTDIR}/usr/include/machine
11321044Sjkh	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1141539Srgrimes
1151539Srgrimes.include <bsd.prog.mk>
116