Makefile revision 88055
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 88055 2001-12-17 13:59:35Z ru $
31539Srgrimes#
41539Srgrimes# Doing a make install builds /usr/include
554351Smarcel#
654351Smarcel# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
754351Smarcel# links.
81539Srgrimes
918420SbdeCLEANFILES= osreldate.h version vers.c
1074462SalfredSUBDIR= rpcsvc rpc
1188055SruHDRS=	a.out.h ar.h assert.h bitstring.h complex.h ctype.h db.h \
1278172Sru	dirent.h disktab.h \
1376317Sobrien	dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
1483134Sru	fts.h glob.h grp.h \
1585892Smike	hesiod.h histedit.h ieeefp.h ifaddrs.h inttypes.h iso646.h langinfo.h \
1683134Sru	libgen.h limits.h link.h locale.h malloc.h memory.h monetary.h mpool.h \
1783134Sru	ndbm.h netconfig.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
1834030Sdufault	paths.h pthread.h pthread_np.h pwd.h \
1986669Sgreen	ranlib.h readpassphrase.h regex.h regexp.h resolv.h rune.h runetype.h \
2062321Salfred	search.h setjmp.h sgtty.h \
2183134Sru	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h strhash.h \
2283134Sru	string.h stringlist.h strings.h sysexits.h tar.h time.h timers.h \
2376680Sru	ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
241539Srgrimes
2588055SruARPAHDRS=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
2617900Speter
2788055SruPROTOHDRS=	dumprestore.h routed.h rwhod.h talkd.h timed.h
2817900Speter
2988055SruNETSMBHDRS=	nb_lib.h smb_lib.h smb_rap.h
3087874Ssheldonh
3188055SruMHDRS=	float.h floatingpoint.h stdarg.h varargs.h
3234030Sdufault
3334030Sdufault# posix4/aio.h conflicts with dysons and isn't installed:
3488055SruPHDRS=	mqueue.h sched.h semaphore.h # aio.h
3534030Sdufault
3654351Smarcel# Only for default SHARED=copies case
3788055SruSHDRS=	soundcard.h joystick.h
3850914Speter
3988055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
4064767Sjhb	termios.h ucontext.h
411539Srgrimes
4277162SruLDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
4383653Speter	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
4483653Speter	pccard posix4 sys vm
4517900Speter
4675415SbpLNOHEADERDIRS=	fs isofs ufs dev
4754351Smarcel
4888050SgreenLSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi fs/devfs \
4977223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
5077162Sru	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
5177434Sphk	ufs/ffs ufs/ufs
5277031Sru
5377046Sru# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
5477046SruLSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
5577046Sru
5654351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5754351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5854351Smarcel# probably only useful for developers and should be avoided if you do not
5954351Smarcel# wish to tie your /usr/include and /usr/src together.
6054351Smarcel#SHARED=	symlinks
6154351SmarcelSHARED?=	copies
6254351Smarcel
6325734Speterall:	osreldate.h
6425734Speter
6536283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6678376Speter		${.CURDIR}/../sys/sys/param.h \
6778376Speter		${.CURDIR}/Makefile
6825734Speter	@${ECHO} creating osreldate.h from newvers.sh
6936283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
7025734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
7125734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
7272673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
7378376Speter	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
7472673Speter	echo "#else" >> osreldate.h;				\
7525734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7672673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7772673Speter	echo "#endif" >> osreldate.h
7825734Speter
7954351Smarcelbeforeinstall: ${SHARED}
8054351Smarcel	@rm -f ${DESTDIR}/usr/include/timepps.h
8117900Speter	cd ${.CURDIR}; \
8254351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8388055Sru		${HDRS} ${DESTDIR}/usr/include
8417900Speter	cd ${.CURDIR}/arpa; \
8554351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8688055Sru		${ARPAHDRS} ${DESTDIR}/usr/include/arpa
8717900Speter	cd ${.CURDIR}/protocols; \
8854351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8988055Sru		${PROTOHDRS} ${DESTDIR}/usr/include/protocols
9054351Smarcel	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9154351Smarcel		${.OBJDIR}/osreldate.h \
9254351Smarcel		${DESTDIR}/usr/include
9388055Sru.for i in ${LHDRS}
9417900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
9517900Speter.endfor
9688055Sru.for i in ${MHDRS}
9717900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
9817900Speter.endfor
9988055Sru.for i in ${PHDRS}
10034030Sdufault	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
10134030Sdufault.endfor
10254351Smarcel
10354351Smarcelcopies:
10477046Sru.for i in ${LDIRS} ${LSYMSUBDIRS} machine
10554351Smarcel	if [ -h ${DESTDIR}/usr/include/$i ]; then \
10654351Smarcel		rm -f ${DESTDIR}/usr/include/$i; \
10754351Smarcel	fi
10854351Smarcel.endfor
10965885Sache	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
11054351Smarcel		-p ${DESTDIR}/usr/include
11154351Smarcel.for i in ${LDIRS} ${LSUBDIRS}
11254351Smarcel	cd ${.CURDIR}/../sys; \
11354351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
11454351Smarcel		${DESTDIR}/usr/include/$i
11554351Smarcel.endfor
11677854Sjlemon.if exists(${.CURDIR}/../sys/contrib/ipfilter/netinet)
11777854Sjlemon	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
11854351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
11977854Sjlemon		${DESTDIR}/usr/include/netinet
12054351Smarcel.endif
12187874Ssheldonh.if exists(${.CURDIR}/../sys/contrib/netsmb/include/netsmb)
12287874Ssheldonh	cd ${.CURDIR}/../sys/contrib/netsmb/include/netsmb; \
12388055Sru		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${NETSMBHDRS} \
12487874Ssheldonh		${DESTDIR}/usr/include/netsmb
12587874Ssheldonh.endif
12686667Sgreen.if exists(${.CURDIR}/../sys/security/lomac)
12786667Sgreen	cd ${.CURDIR}/../sys/security/lomac; \
12886574Sgreen		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 lomac.h \
12986574Sgreen		lomacio.h ${DESTDIR}/usr/include/sys
13086574Sgreen.endif
13177857Sjlemon.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
13277857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
13377857Sjlemon		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
13477857Sjlemon		${DESTDIR}/usr/include/machine
13577857Sjlemon.endif
13688055Sru.for i in ${SHDRS}
13750949Speter	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
13850949Speter.endfor
1391539Srgrimes
14054351Smarcelsymlinks:
14154351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
14256645Speter.for i in ${LDIRS}
14354351Smarcel	rm -rf ${DESTDIR}/usr/include/$i
14454351Smarcel	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
14554351Smarcel.endfor
14656645Speter.for i in ${LNOHEADERDIRS}
14756645Speter	rm -rf ${DESTDIR}/usr/include/$i
14877046Sru	mkdir ${DESTDIR}/usr/include/$i
14956645Speter.endfor
15077046Sru.for i in ${LSYMSUBDIRS}
15177046Sru	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
15277046Sru.endfor
15354351Smarcel	rm -rf ${DESTDIR}/usr/include/machine
15454351Smarcel	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
15554351Smarcel
1561539Srgrimes.include <bsd.prog.mk>
157