Makefile revision 34030
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
234030Sdufault#	$Id: Makefile,v 1.72 1998/02/13 03:10:26 bde 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 \
1433236Sjdp	dlfcn.h elf.h err.h fnmatch.h fstab.h \
1533236Sjdp	fts.h glob.h grp.h strhash.h histedit.h \
1625659Sdavidn	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h \
1734030Sdufault	ndbm.h netdb.h nl_types.h nlist.h \
1834030Sdufault	paths.h pthread.h pthread_np.h pwd.h \
1917706Sjulian	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
2026924Smsmith	signal.h stab.h stddef.h stdio.h stdlib.h string.h stringlist.h \
2126924Smsmith	strings.h struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h \
2226924Smsmith	utime.h utmp.h vis.h
237242Sphk.if defined(WANT_CSRG_LIBM)
242573SbdeFILES+=	math.h
252573Sbde.endif
261539Srgrimes
2730087SmarkmARPAFILES=	ftp.h inet.h nameser.h telnet.h tftp.h
2817900Speter
2917900SpeterPROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
3017900Speter
3117900SpeterRPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
3226212Swpaul		rpc.h rpc_com.h rpc_msg.h svc.h svc_auth.h types.h xdr.h \
3333298Sbde		auth_des.h des.h des_crypt.h
3417900Speter
353329SbdeMFILES=	float.h floatingpoint.h stdarg.h varargs.h
3634030Sdufault
3734030Sdufault# posix4/aio.h conflicts with dysons and isn't installed:
3834030SdufaultPFILES=	mqueue.h posix4.h sched.h semaphore.h \
3934030Sdufault		# aio.h
4034030Sdufault
4129370SpeterLFILES=	errno.h fcntl.h poll.h syslog.h termios.h
421539Srgrimes
4334030SdufaultLDIRS=	msdosfs net netns netatalk netinet netipx netkey nfs \
4434030Sdufault		pccard posix4 sys vm \
4518999Sjkh		# netccitt netiso
4617900Speter
4723263SbdeLNOHEADERDIRS=	isofs ufs
4832928SimpLSUBDIRS=	isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs
491539Srgrimes
501539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
5126457Sjkh# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5226457Sjkh# probably only useful for developers and should be avoided if you do not
5326457Sjkh# wish to tie your /usr/include and /usr/src together.
5426457Sjkh#SHARED=	symlinks
5526457SjkhSHARED?=	copies
561539Srgrimes
5725734Speter
5825734Speter.if exists (${.CURDIR}/../sys/conf/newvers.sh)
5925734Speterall:	osreldate.h
6025734Speter
6125734Speterosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh
6225734Speter	@${ECHO} creating osreldate.h from newvers.sh
6325734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6425734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6525734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6625734Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
6725734Speter.else
6825734Speterall:
6925734Speter	@${ECHO} creating osreldate.h from sysctl info
7025734Speter	echo \#'undef __FreeBSD_version' > osreldate.h
7125734Speter	echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
7225734Speter		>> osreldate.h
7325734Speter.endif
7425734Speter
7529504Sbdebeforeinstall: ${SHARED}
7617900Speter	cd ${.CURDIR}; \
7717900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7817900Speter		${FILES} ${DESTDIR}/usr/include
7917900Speter	cd ${.CURDIR}/arpa; \
8017900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8117900Speter		${ARPAFILES} ${DESTDIR}/usr/include/arpa
8217900Speter	cd ${.CURDIR}/protocols; \
8317900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8417900Speter		${PROTOFILES} ${DESTDIR}/usr/include/protocols
8517992Sadam	cd ${.CURDIR}/rpc; \
8617992Sadam		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8717992Sadam		${RPCFILES} ${DESTDIR}/usr/include/rpc
8832170Ssteve	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8932181Sjkh		${.OBJDIR}/osreldate.h \
9017900Speter		${DESTDIR}/usr/include
9117900Speter.for i in ${LFILES}
9217900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
9317900Speter.endfor
9417900Speter.for i in ${MFILES}
9517900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
9617900Speter.endfor
9734030Sdufault.for i in ${PFILES}
9834030Sdufault	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
9934030Sdufault.endfor
1001539Srgrimes
10134030Sdufault
1021539Srgrimescopies:
10323263Sbde.for i in ${LDIRS} ${LNOHEADERDIRS} machine
10417900Speter	if [ -h ${DESTDIR}/usr/include/$i ]; then \
10517900Speter		rm -f ${DESTDIR}/usr/include/$i; \
10617900Speter	fi
10717900Speter.endfor
10823566Sbde	mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
10923566Sbde		-p ${DESTDIR}/usr/include
11023263Sbde.for i in ${LDIRS} ${LSUBDIRS}
11117900Speter	cd ${.CURDIR}/../sys; \
11217900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
11317900Speter		${DESTDIR}/usr/include/$i
11417900Speter.endfor
11517900Speter.if exists(${.CURDIR}/../sys/${MACHINE}/include)
11617900Speter	cd ${.CURDIR}/../sys/${MACHINE}/include; \
11717900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
11817900Speter		${DESTDIR}/usr/include/machine
11917900Speter.endif
1201539Srgrimes
1211539Srgrimessymlinks:
12217954Speter	@${ECHO} "Setting up symlinks to kernel source tree..."
12323263Sbde.for i in ${LDIRS} ${LNOHEADERDIRS}
12417954Speter	rm -rf ${DESTDIR}/usr/include/$i
12527803Sasami	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
12617900Speter.endfor
12717954Speter	rm -rf ${DESTDIR}/usr/include/machine
12827803Sasami	ln -s ../../sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1291539Srgrimes
1301539Srgrimes.include <bsd.prog.mk>
131