Makefile revision 114731
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 114731 2003-05-05 12:54:26Z bde $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
618420SbdeCLEANFILES= osreldate.h version vers.c
796462SruSUBDIR= arpa protocols rpcsvc rpc
8101138SmikeINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
9107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
10107046Smarcel	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
11107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
12107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
13113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
14113595Snectar	pthread.h \
15107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
16107046Smarcel	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
17107046Smarcel	stdbool.h stddef.h stdio.h stdlib.h strhash.h string.h stringlist.h \
18107046Smarcel	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
19108287Stjr	ulimit.h unistd.h utime.h utmp.h uuid.h vis.h wchar.h wctype.h \
20108287Stjr	wordexp.h
211539Srgrimes
2288055SruMHDRS=	float.h floatingpoint.h stdarg.h varargs.h
2334030Sdufault
24104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
25104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2634030Sdufault
2788055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
2864767Sjhb	termios.h ucontext.h
291539Srgrimes
30110542SphkLDIRS=	cam geom net netatalk netatm netgraph netinet netinet6 netipsec \
31111924Speter	netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3283653Speter	pccard posix4 sys vm
3317900Speter
34108433SsimokawaLSUBDIRS=	cam/scsi dev/an dev/ic dev/iicbus dev/firewire dev/ofw \
35108433Ssimokawa	dev/ppbus dev/smbus dev/usb dev/wi fs/devfs \
3677223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
3777162Sru	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
3893229Sru	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
39107547Srwatson	security/mac_biba security/mac_bsdextended security/mac_lomac\
40105875Srwatson	security/mac_mls security/mac_partition ufs/ffs ufs/ufs
4177031Sru
42114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
43107139Sjulian
4454351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
4554351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
4654351Smarcel# probably only useful for developers and should be avoided if you do not
4754351Smarcel# wish to tie your /usr/include and /usr/src together.
4854351Smarcel#SHARED=	symlinks
4954351SmarcelSHARED?=	copies
5054351Smarcel
5196462SruINCS+=	osreldate.h
5225734Speter
5336283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
5478376Speter		${.CURDIR}/../sys/sys/param.h \
5578376Speter		${.CURDIR}/Makefile
5625734Speter	@${ECHO} creating osreldate.h from newvers.sh
5736283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
5825734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
5925734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6072673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
61114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
6272673Speter	echo "#else" >> osreldate.h;				\
6325734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6472673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
6572673Speter	echo "#endif" >> osreldate.h
6625734Speter
6788055Sru.for i in ${LHDRS}
6896462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
6917900Speter.endfor
7088055Sru.for i in ${MHDRS}
7196462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7217900Speter.endfor
7388055Sru.for i in ${PHDRS}
7496462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
7534030Sdufault.endfor
7654351Smarcel
77114731Sbde.include <bsd.prog.mk>
78114731Sbde
79114731Sbdeinstallincludes: ${SHARED}
80114731Sbde${SHARED}: compat
81114731Sbde
82114731Sbde# Take care of stale directory-level symlinks.
83114731Sbdecompat:
84114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
85114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
86114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
8754351Smarcel	fi
8854351Smarcel.endfor
89114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
90114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
91114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
92114731Sbde
93114731Sbdecopies:
94114731Sbde.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
95114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
96114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
97114731Sbde	for h in *.h; do \
98114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
99114731Sbde	done
100114731Sbde.endif
101114731Sbde.endfor
102114731Sbde.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS}
10354351Smarcel	cd ${.CURDIR}/../sys; \
104114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
105114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
10654351Smarcel.endfor
107104489Ssam	cd ${.CURDIR}/../sys; \
108114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 opencrypto/*.h \
109114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
11077857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
111114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
112114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
11393229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
11493229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
115114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
116114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
11777857Sjlemon.endif
1181539Srgrimes
11954351Smarcelsymlinks:
12054351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
12156645Speter.for i in ${LDIRS}
122114731Sbde	cd ${.CURDIR}/../sys/$i; \
123114731Sbde	for h in *.h; do \
124114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
125114731Sbde	done
12654351Smarcel.endfor
127114731Sbde.for i in ${LSUBDIRS}
128114731Sbde	cd ${.CURDIR}/../sys/$i; \
129114731Sbde	for h in *.h; do \
130114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
131114731Sbde	done
13277046Sru.endfor
133114731Sbde.for i in ${LSUBSUBDIRS}
134114731Sbde	cd ${.CURDIR}/../sys/$i; \
135114731Sbde	for h in *.h; do \
136114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
137114731Sbde	done
138114731Sbde.endfor
139114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
140114731Sbde	for h in *.h; do \
141114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
142114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
143114731Sbde	done
144114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
145114731Sbde	for h in *.h; do \
146114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
147114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
148114731Sbde	done
149114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
150114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
151114731Sbde	for h in *.h; do \
152114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
153114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
154114731Sbde	done
155114731Sbde.endif
156