Makefile revision 107046
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 107046 2002-11-18 07:34:56Z marcel $
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
1096462SruSUBDIR= arpa protocols rpcsvc rpc
11101138SmikeINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
12107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13107046Smarcel	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
14107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
15107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
16107046Smarcel	netdb.h nl_types.h nlist.h nsswitch.h objformat.h paths.h pthread.h \
17107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18107046Smarcel	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
19107046Smarcel	stdbool.h stddef.h stdio.h stdlib.h strhash.h string.h stringlist.h \
20107046Smarcel	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
21107046Smarcel	ulimit.h unistd.h utime.h utmp.h uuid.h vis.h wchar.h wctype.h
221539Srgrimes
2388055SruMHDRS=	float.h floatingpoint.h stdarg.h varargs.h
2434030Sdufault
25104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
26104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2734030Sdufault
2888055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
2964767Sjhb	termios.h ucontext.h
301539Srgrimes
31105376SsamLDIRS=	cam net netatalk netatm netgraph netinet netinet6 netipsec \
3283653Speter	netipx netkey netnatm netncp netns netsmb nfs nfsclient nfsserver \
3383653Speter	pccard posix4 sys vm
3417900Speter
35105400StmmLSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/ofw dev/ppbus dev/smbus \
36103589Speter	dev/usb dev/wi fs/devfs \
3777223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
3877162Sru	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
3993229Sru	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
40101204Srwatson	security/lomac security/mac_biba security/mac_bsdextended \
41105875Srwatson	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
4277031Sru
4393229Sru# For SHARED=symlinks, cam and netatm are symlinks, so cam/scsi and netatm/*
4493229Sru# are taken care of
4593229SruLSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi:Nnetatm/*}
4677046Sru
4754351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
4854351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
4954351Smarcel# probably only useful for developers and should be avoided if you do not
5054351Smarcel# wish to tie your /usr/include and /usr/src together.
5154351Smarcel#SHARED=	symlinks
5254351SmarcelSHARED?=	copies
5354351Smarcel
5496462SruINCS+=	osreldate.h
5525734Speter
5636283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
5778376Speter		${.CURDIR}/../sys/sys/param.h \
5878376Speter		${.CURDIR}/Makefile
5925734Speter	@${ECHO} creating osreldate.h from newvers.sh
6036283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6125734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6225734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6372673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
6478376Speter	echo '#error "/usr/include/osreldate.h cannot be used in the kernel, use sys/param.h"' >> osreldate.h; \
6572673Speter	echo "#else" >> osreldate.h;				\
6625734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6772673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
6872673Speter	echo "#endif" >> osreldate.h
6925734Speter
7088055Sru.for i in ${LHDRS}
7196462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7217900Speter.endfor
7388055Sru.for i in ${MHDRS}
7496462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7517900Speter.endfor
7688055Sru.for i in ${PHDRS}
7796462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
7834030Sdufault.endfor
7954351Smarcel
8054351Smarcelcopies:
81104489Ssam.for i in ${LDIRS} ${LSYMSUBDIRS} machine crypto
82104288Sru	if [ -L ${DESTDIR}/usr/include/$i ]; then \
8354351Smarcel		rm -f ${DESTDIR}/usr/include/$i; \
8454351Smarcel	fi
8554351Smarcel.endfor
8665885Sache	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
8754351Smarcel		-p ${DESTDIR}/usr/include
8854351Smarcel.for i in ${LDIRS} ${LSUBDIRS}
8954351Smarcel	cd ${.CURDIR}/../sys; \
9054351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
9154351Smarcel		${DESTDIR}/usr/include/$i
9254351Smarcel.endfor
93104489Ssam	cd ${.CURDIR}/../sys; \
94104489Ssam		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
95104489Ssam		${DESTDIR}/usr/include/crypto
9677857Sjlemon.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
9777857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
9877857Sjlemon		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
9977857Sjlemon		${DESTDIR}/usr/include/machine
10093229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
10193229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
10293229Sru		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
10393229Sru		${DESTDIR}/usr/include/machine/pc
10477857Sjlemon.endif
10593229Sru.endif
1061539Srgrimes
10754351Smarcelsymlinks:
10854351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
10956645Speter.for i in ${LDIRS}
11054351Smarcel	rm -rf ${DESTDIR}/usr/include/$i
11154351Smarcel	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
11254351Smarcel.endfor
113104489Ssam	rm -rf ${DESTDIR}/usr/include/crypto
114104489Ssam	ln -s ../../sys/opencrypto ${DESTDIR}/usr/include/crypto
11593730Sru.for i in ${LSYMSUBDIRS}
11656645Speter	rm -rf ${DESTDIR}/usr/include/$i
11777046Sru	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
11877046Sru.endfor
11954351Smarcel	rm -rf ${DESTDIR}/usr/include/machine
12054351Smarcel	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
12154351Smarcel
12296668Sru.include <bsd.prog.mk>
12396462Sru
12496668Sruinstallincludes: ${SHARED}
125