Makefile revision 171453
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 171453 2007-07-14 21:49:24Z rwatson $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
6156813Sru.include <bsd.own.mk>
7156813Sru
818420SbdeCLEANFILES= osreldate.h version vers.c
9153838SdfrSUBDIR= arpa gssapi protocols rpcsvc rpc
10133567StjrINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11133559Stjr	db.h \
12107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13153838Sdfr	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
14148796Sphk	histedit.h ieeefp.h ifaddrs.h \
15107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16157236Sjasone	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17152994Sru	ndbm.h netconfig.h \
18166243Speter	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
19153486Sphk	printf.h proc_service.h pthread.h \
20107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
21157308Sume	res_update.h resolv.h runetype.h search.h setjmp.h sgtty.h \
22142582Sru	signal.h stab.h \
23121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
25133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
26119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27119630Skan	wctype.h wordexp.h
281539Srgrimes
29171271SbzI4BHDRS=i4b_cause.h i4b_debug.h i4b_ioctl.h i4b_rbch_ioctl.h \
30171271Sbz	i4b_tel_ioctl.h i4b_trace.h
31171271Sbz
32119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
3334030Sdufault
34152868SrodrigcPHDRS=	sched.h semaphore.h _semaphore.h
3534030Sdufault
3688055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3764767Sjhb	termios.h ucontext.h
381539Srgrimes
39171453SrwatsonLDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
40171135Sgnn	netipsec ${_netipx} netnatm ${_netncp} netsmb \
41156905Sru	nfs nfsclient nfsserver \
42168677Spjd	pccard sys vm
43171453Srwatson#LDIRS+=	netatm
4417900Speter
45146795SrwatsonLSUBDIRS=	cam/scsi \
46147191Sjkoshy	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
47150850Sscottl	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
48162117Semax	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
49140246Sdds	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
50171023Srafan	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
51163851Spjd	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
52163851Spjd	geom/mirror geom/nop geom/raid3 geom/shsec geom/stripe \
53135339Sglebius	netgraph/atm netgraph/netflow \
54156885Srwatson	security/audit \
55135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
56135339Sglebius	security/mac_mls security/mac_partition \
57137556Smarkm	ufs/ffs ufs/ufs
58171453Srwatson#LSUBDIRS+=	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni
5977031Sru
60160892Ssobomax.if ${MACHINE_ARCH} == "powerpc"
61160892Ssobomax_dev_powermac_nvram=	dev/powermac_nvram
62160892Ssobomax.endif
63160892Ssobomax
64156813Sru.if ${MK_GPIB} != "no"
65141397Sphk_dev_ieee488=	dev/ieee488
66141397Sphk.endif
67141397Sphk
68156813Sru.if ${MK_HESIOD} != "no"
69148796SphkINCS+=	hesiod.h
70148796Sphk.endif
71148796Sphk
72156813Sru.if ${MK_BLUETOOTH} != "no"
73114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
74125123Semax.endif
75107139Sjulian
76156905Sru# XXX unconditionally needed by <netsmb/netbios.h>
77156905Sru#.if ${MK_IPX} != "no"
78156905Sru_netipx=	netipx
79156905Sru#.endif
80156905Sru
81156905Sru.if ${MK_NCP} != "no"
82156905Sru_netncp=	netncp
83156905Sru_fs_nwfs=	fs/nwfs
84156905Sru.endif
85156905Sru
8654351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
8754351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
8854351Smarcel# probably only useful for developers and should be avoided if you do not
8954351Smarcel# wish to tie your /usr/include and /usr/src together.
9054351Smarcel#SHARED=	symlinks
9154351SmarcelSHARED?=	copies
9254351Smarcel
9396462SruINCS+=	osreldate.h
9425734Speter
95156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
96156532Sru    ${.CURDIR}/Makefile
9725734Speter	@${ECHO} creating osreldate.h from newvers.sh
98156532Sru	@MAKE=${MAKE}; \
99156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
100156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
101156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
102156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
103156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
104156531Sru	echo "#else" >> osreldate.h; \
105156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
106156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
10772673Speter	echo "#endif" >> osreldate.h
10825734Speter
10988055Sru.for i in ${LHDRS}
11096462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11117900Speter.endfor
11288055Sru.for i in ${MHDRS}
11396462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11417900Speter.endfor
11588055Sru.for i in ${PHDRS}
116164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11734030Sdufault.endfor
11854351Smarcel
119144514Simp.if ${MACHINE} != ${MACHINE_ARCH}
120144514Simp_MARCH=${MACHINE_ARCH}
121144514Simp.endif
122144514Simp
123114731Sbde.include <bsd.prog.mk>
124114731Sbde
125114731Sbdeinstallincludes: ${SHARED}
126114731Sbde${SHARED}: compat
127114731Sbde
128114731Sbde# Take care of stale directory-level symlinks.
129114731Sbdecompat:
130144514Simp.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
131114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
132114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13354351Smarcel	fi
13454351Smarcel.endfor
135114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
136114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
137114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
138156813Sru.if ${MK_BIND_LIBS} != "no"
139135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
140135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
141135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
142135851Sdougb.endif
143114731Sbde
144114731Sbdecopies:
145144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
146144514Simp	${_MARCH}
147114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
148114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
149114731Sbde	for h in *.h; do \
150114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
151114731Sbde	done
152114731Sbde.endif
153114731Sbde.endfor
154143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
15554351Smarcel	cd ${.CURDIR}/../sys; \
156114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
157114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
15854351Smarcel.endfor
159143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
160143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
161143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
162123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
163123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
164123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
165130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
166130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
167130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
168166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
169166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
170166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
171156813Sru.if ${MK_IPFILTER} != "no"
172116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
173116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
174116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
175145539Sscottl.endif
176126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
177126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
178126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
179143423Sume	cd ${.CURDIR}/../sys/crypto; \
180143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
181143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
182171271Sbz.if ${MACHINE_ARCH} == "i386"
183171271Sbz.if ${MK_I4B} != "no"
184171271Sbz	cd ${.CURDIR}/../sys/i4b/include; \
185171271Sbz	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${I4BHDRS} \
186171271Sbz	    ${DESTDIR}${INCLUDEDIR}/i4b
187171271Sbz.endif
188171271Sbz.endif
189116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
190116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
192144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
193114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
194114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
195144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
196144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
197114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
19977857Sjlemon.endif
200144514Simp.if defined(_MARCH)
201144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
202144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
203144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
204144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
205144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
206144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
207144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
208144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
209144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
210144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
211144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
212144514Simp.endif
213144514Simp.endif
214168677Spjd	cd ${.CURDIR}/../sys/rpc; \
215168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
216168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2171539Srgrimes
21854351Smarcelsymlinks:
21954351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
22056645Speter.for i in ${LDIRS}
221114731Sbde	cd ${.CURDIR}/../sys/$i; \
222114731Sbde	for h in *.h; do \
223114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
224114731Sbde	done
22554351Smarcel.endfor
226143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
227114731Sbde	cd ${.CURDIR}/../sys/$i; \
228114731Sbde	for h in *.h; do \
229114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
230114731Sbde	done
23177046Sru.endfor
232143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
233143013Snjl	for h in acpiio.h; do \
234143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
235143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
236143013Snjl	done
237142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
238142992Sru	for h in ioctl_*.h; do \
239142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
240142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
241142992Sru	done
242114731Sbde.for i in ${LSUBSUBDIRS}
243114731Sbde	cd ${.CURDIR}/../sys/$i; \
244114731Sbde	for h in *.h; do \
245114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
246114731Sbde	done
247114731Sbde.endfor
248130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
249130416Smlaier	for h in *.h; do \
250130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
251130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
252130416Smlaier	done
253156813Sru.if ${MK_IPFILTER} != "no"
254116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
255116734Sru	for h in *.h; do \
256116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
257116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
258116734Sru	done
259145539Sscottl.endif
260126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
261126385Smlaier	for h in *.h; do \
262126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
263126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
264126385Smlaier	done
265143423Sume	cd ${.CURDIR}/../sys/crypto; \
266143423Sume	for h in rijndael/rijndael.h; do \
267143423Sume		ln -fs ../../../sys/crypto/$$h \
268143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
269143423Sume	done
270171271Sbz	cd ${.CURDIR}/../sys/i4b/include; \
271171271Sbz	for h in ${I4BHDRS}; do \
272171271Sbz		ln -fs ../../../sys/i4b/include/$$h \
273171271Sbz		    ${DESTDIR}${INCLUDEDIR}/i4b; \
274171271Sbz	done
275114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
276114731Sbde	for h in *.h; do \
277114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
278114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
279114731Sbde	done
280144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
281114731Sbde	for h in *.h; do \
282144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
283114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
284114731Sbde	done
285144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
286144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
287114731Sbde	for h in *.h; do \
288144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
289114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
290114731Sbde	done
291114731Sbde.endif
292144514Simp.if defined(_MARCH)
293144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
294144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
295144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
296144514Simp	for h in *.h; do \
297144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
298144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
299144514Simp	done
300144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
301144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
302144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
303144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
304144514Simp	for h in *.h; do \
305144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
306144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
307144514Simp	done
308144514Simp.endif
309144514Simp.endif
310166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
311166640Srodrigc	for h in *.h; do \
312166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
313166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
314166640Srodrigc	done
315168677Spjd	cd ${.CURDIR}/../sys/rpc; \
316168677Spjd	for h in types.h; do \
317168677Spjd		ln -fs ../../../sys/rpc/$$h \
318168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
319168677Spjd	done
320