Makefile revision 130416
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 130416 2004-06-13 17:29:10Z mlaier $
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 \
17121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
18107046Smarcel	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
19119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
20119630Skan	wctype.h wordexp.h
211539Srgrimes
22119630SkanMHDRS=	float.h floatingpoint.h stdarg.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
30116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
31116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3283653Speter	pccard posix4 sys vm
3317900Speter
34123288SobrienLSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
35123288Sobrien	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
3677223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
37128769Spjd	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
38129476Spjd	geom/concat geom/gate geom/nop geom/stripe \
39128769Spjd	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
40116811Sharti	netgraph/atm security/mac_biba security/mac_bsdextended \
41116811Sharti	security/mac_lomac security/mac_mls security/mac_partition \
42116811Sharti	ufs/ffs ufs/ufs
4377031Sru
44125123Semax.if !defined(NO_BLUETOOTH)
45114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
46125123Semax.endif
47107139Sjulian
4854351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
4954351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5054351Smarcel# probably only useful for developers and should be avoided if you do not
5154351Smarcel# wish to tie your /usr/include and /usr/src together.
5254351Smarcel#SHARED=	symlinks
5354351SmarcelSHARED?=	copies
5454351Smarcel
5596462SruINCS+=	osreldate.h
5625734Speter
5736283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
5878376Speter		${.CURDIR}/../sys/sys/param.h \
5978376Speter		${.CURDIR}/Makefile
6025734Speter	@${ECHO} creating osreldate.h from newvers.sh
61117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6225734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6325734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6472673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
65114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
6672673Speter	echo "#else" >> osreldate.h;				\
6725734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6872673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
6972673Speter	echo "#endif" >> osreldate.h
7025734Speter
7188055Sru.for i in ${LHDRS}
7296462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7317900Speter.endfor
7488055Sru.for i in ${MHDRS}
7596462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7617900Speter.endfor
7788055Sru.for i in ${PHDRS}
7896462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
7934030Sdufault.endfor
8054351Smarcel
81114731Sbde.include <bsd.prog.mk>
82114731Sbde
83114731Sbdeinstallincludes: ${SHARED}
84114731Sbde${SHARED}: compat
85114731Sbde
86114731Sbde# Take care of stale directory-level symlinks.
87114731Sbdecompat:
88114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
89114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
90114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
9154351Smarcel	fi
9254351Smarcel.endfor
93114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
94114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
95114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
96114731Sbde
97114731Sbdecopies:
98114731Sbde.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
99114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
100114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
101114731Sbde	for h in *.h; do \
102114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
103114731Sbde	done
104114731Sbde.endif
105114731Sbde.endfor
106123288Sobrien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
10754351Smarcel	cd ${.CURDIR}/../sys; \
108114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
109114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
11054351Smarcel.endfor
111123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
112123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
113123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
114130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
115130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
116130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
117116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
118116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
119116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
120126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
121126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
122126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
123116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
124116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
125114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
12677857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
127114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
128114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
12993229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
13093229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
131114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
132114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
13377857Sjlemon.endif
1341539Srgrimes
13554351Smarcelsymlinks:
13654351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
13756645Speter.for i in ${LDIRS}
138114731Sbde	cd ${.CURDIR}/../sys/$i; \
139114731Sbde	for h in *.h; do \
140114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
141114731Sbde	done
14254351Smarcel.endfor
143114731Sbde.for i in ${LSUBDIRS}
144114731Sbde	cd ${.CURDIR}/../sys/$i; \
145114731Sbde	for h in *.h; do \
146114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
147114731Sbde	done
14877046Sru.endfor
149114731Sbde.for i in ${LSUBSUBDIRS}
150114731Sbde	cd ${.CURDIR}/../sys/$i; \
151114731Sbde	for h in *.h; do \
152114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
153114731Sbde	done
154114731Sbde.endfor
155130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
156130416Smlaier	for h in *.h; do \
157130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
158130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
159130416Smlaier	done
160116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
161116734Sru	for h in *.h; do \
162116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
163116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
164116734Sru	done
165126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
166126385Smlaier	for h in *.h; do \
167126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
168126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
169126385Smlaier	done
170114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
171114731Sbde	for h in *.h; do \
172114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
173114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
174114731Sbde	done
175114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
176114731Sbde	for h in *.h; do \
177114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
178114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
179114731Sbde	done
180114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
181114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
182114731Sbde	for h in *.h; do \
183114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
184114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
185114731Sbde	done
186114731Sbde.endif
187