Makefile revision 195534
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 195534 2009-07-10 08:18:08Z scottl $
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 \
21180800Sed	res_update.h resolv.h runetype.h search.h setjmp.h \
22179838Sdavidxu	signal.h spawn.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
29119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
3034030Sdufault
31152868SrodrigcPHDRS=	sched.h semaphore.h _semaphore.h
3234030Sdufault
3388055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3464767Sjhb	termios.h ucontext.h
351539Srgrimes
36171453SrwatsonLDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
37171135Sgnn	netipsec ${_netipx} netnatm ${_netncp} netsmb \
38156905Sru	nfs nfsclient nfsserver \
39188642Snyan	sys vm
4017900Speter
41195534SscottlLSUBDIRS=	cam/ata cam/scsi \
42147191Sjkoshy	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
43150850Sscottl	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
44172397Sru	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
45172397Sru	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
46192545Srmacklem	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \
47171023Srafan	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
48163851Spjd	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
49172397Sru	geom/mirror geom/multipath geom/nop \
50172397Sru	geom/raid3 geom/shsec geom/stripe geom/virstor \
51135339Sglebius	netgraph/atm netgraph/netflow \
52156885Srwatson	security/audit \
53135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
54135339Sglebius	security/mac_mls security/mac_partition \
55137556Smarkm	ufs/ffs ufs/ufs
5677031Sru
57192901SthompsaLSUBSUBDIRS=	dev/mpt/mpilib
58178818Sjhb
59160892Ssobomax.if ${MACHINE_ARCH} == "powerpc"
60160892Ssobomax_dev_powermac_nvram=	dev/powermac_nvram
61160892Ssobomax.endif
62160892Ssobomax
63156813Sru.if ${MK_GPIB} != "no"
64141397Sphk_dev_ieee488=	dev/ieee488
65141397Sphk.endif
66141397Sphk
67156813Sru.if ${MK_HESIOD} != "no"
68148796SphkINCS+=	hesiod.h
69148796Sphk.endif
70148796Sphk
71156813Sru.if ${MK_BLUETOOTH} != "no"
72178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
73125123Semax.endif
74107139Sjulian
75156905Sru# XXX unconditionally needed by <netsmb/netbios.h>
76156905Sru#.if ${MK_IPX} != "no"
77156905Sru_netipx=	netipx
78156905Sru#.endif
79156905Sru
80156905Sru.if ${MK_NCP} != "no"
81156905Sru_netncp=	netncp
82156905Sru_fs_nwfs=	fs/nwfs
83156905Sru.endif
84156905Sru
8554351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
8654351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
8754351Smarcel# probably only useful for developers and should be avoided if you do not
8854351Smarcel# wish to tie your /usr/include and /usr/src together.
8954351Smarcel#SHARED=	symlinks
9054351SmarcelSHARED?=	copies
9154351Smarcel
9296462SruINCS+=	osreldate.h
9325734Speter
94156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
95156532Sru    ${.CURDIR}/Makefile
9625734Speter	@${ECHO} creating osreldate.h from newvers.sh
97156532Sru	@MAKE=${MAKE}; \
98156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
99156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
100156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
101156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
102156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
103156531Sru	echo "#else" >> osreldate.h; \
104156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
105156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
106183390Speter	echo "#endif" >> osreldate.h
10725734Speter
10888055Sru.for i in ${LHDRS}
10996462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11017900Speter.endfor
11188055Sru.for i in ${MHDRS}
11296462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11317900Speter.endfor
11488055Sru.for i in ${PHDRS}
115164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11634030Sdufault.endfor
11754351Smarcel
118144514Simp.if ${MACHINE} != ${MACHINE_ARCH}
119144514Simp_MARCH=${MACHINE_ARCH}
120144514Simp.endif
121144514Simp
122114731Sbde.include <bsd.prog.mk>
123114731Sbde
124114731Sbdeinstallincludes: ${SHARED}
125114731Sbde${SHARED}: compat
126114731Sbde
127114731Sbde# Take care of stale directory-level symlinks.
128114731Sbdecompat:
129144514Simp.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
130114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
131114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13254351Smarcel	fi
13354351Smarcel.endfor
134114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
135114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
136114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
137156813Sru.if ${MK_BIND_LIBS} != "no"
138135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
139135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
140135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
141135851Sdougb.endif
142114731Sbde
143114731Sbdecopies:
144144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
145144514Simp	${_MARCH}
146114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
147114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
148114731Sbde	for h in *.h; do \
149114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
150114731Sbde	done
151114731Sbde.endif
152114731Sbde.endfor
153143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
15454351Smarcel	cd ${.CURDIR}/../sys; \
155114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
156114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
15754351Smarcel.endfor
158143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
159143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
160143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
161123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
162123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
163123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
164130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
165130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
166130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
167166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
168166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
170156813Sru.if ${MK_IPFILTER} != "no"
171116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
172116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
174145539Sscottl.endif
175126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
176126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
177126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
178143423Sume	cd ${.CURDIR}/../sys/crypto; \
179143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
180143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
181116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
182116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
183114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
184144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
185114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
186114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
187144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
188144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
189114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
190114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
19177857Sjlemon.endif
192144514Simp.if defined(_MARCH)
193144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
194144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
195144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
196144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
198144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
199144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
200144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
201144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
202144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
203144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
204144514Simp.endif
205144514Simp.endif
206168677Spjd	cd ${.CURDIR}/../sys/rpc; \
207168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
208168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2091539Srgrimes
21054351Smarcelsymlinks:
21154351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
21256645Speter.for i in ${LDIRS}
213114731Sbde	cd ${.CURDIR}/../sys/$i; \
214114731Sbde	for h in *.h; do \
215114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
216114731Sbde	done
21754351Smarcel.endfor
218143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
219114731Sbde	cd ${.CURDIR}/../sys/$i; \
220114731Sbde	for h in *.h; do \
221114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
222114731Sbde	done
22377046Sru.endfor
224143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
225143013Snjl	for h in acpiio.h; do \
226143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
227143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
228143013Snjl	done
229142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
230142992Sru	for h in ioctl_*.h; do \
231142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
232142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
233142992Sru	done
234114731Sbde.for i in ${LSUBSUBDIRS}
235114731Sbde	cd ${.CURDIR}/../sys/$i; \
236114731Sbde	for h in *.h; do \
237114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
238114731Sbde	done
239114731Sbde.endfor
240130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
241130416Smlaier	for h in *.h; do \
242130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
243130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
244130416Smlaier	done
245156813Sru.if ${MK_IPFILTER} != "no"
246116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
247116734Sru	for h in *.h; do \
248116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
249116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
250116734Sru	done
251145539Sscottl.endif
252126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
253126385Smlaier	for h in *.h; do \
254126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
255126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
256126385Smlaier	done
257143423Sume	cd ${.CURDIR}/../sys/crypto; \
258143423Sume	for h in rijndael/rijndael.h; do \
259143423Sume		ln -fs ../../../sys/crypto/$$h \
260143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
261143423Sume	done
262114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
263114731Sbde	for h in *.h; do \
264114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
265114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
266114731Sbde	done
267144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
268114731Sbde	for h in *.h; do \
269144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
270114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
271114731Sbde	done
272144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
273144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
274114731Sbde	for h in *.h; do \
275144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
276114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
277114731Sbde	done
278114731Sbde.endif
279144514Simp.if defined(_MARCH)
280144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
281144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
282144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
283144514Simp	for h in *.h; do \
284144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
285144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
286144514Simp	done
287144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
288144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
289144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
290144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
291144514Simp	for h in *.h; do \
292144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
293144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
294144514Simp	done
295144514Simp.endif
296144514Simp.endif
297166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
298166640Srodrigc	for h in *.h; do \
299166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
300166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
301166640Srodrigc	done
302168677Spjd	cd ${.CURDIR}/../sys/rpc; \
303168677Spjd	for h in types.h; do \
304168677Spjd		ln -fs ../../../sys/rpc/$$h \
305168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
306168677Spjd	done
307