Makefile revision 214629
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 214629 2010-11-01 17:34:04Z jhb $
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 \
20205146Sed	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
21201546Sdavidxu	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
22179838Sdavidxu	signal.h spawn.h stab.h \
23121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24199898Sed	strings.h sysexits.h tar.h termios.h tgmath.h \
25133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
26204649Sed	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
27202188Sed	wchar.h wctype.h wordexp.h
281539Srgrimes
29119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
3034030Sdufault
31201546SdavidxuPHDRS=	sched.h _semaphore.h
3234030Sdufault
3388055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34199898Sed	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 \
43196200Sscottl	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/mfi 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 \
49202437Strasz	geom/mirror geom/mountver 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
59210024Snwhitehorn.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
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
118211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
119214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
120144514Simp.endif
121214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
122214629Sjhb_MARCHS+=	x86
123214629Sjhb.endif
124144514Simp
125114731Sbde.include <bsd.prog.mk>
126114731Sbde
127114731Sbdeinstallincludes: ${SHARED}
128114731Sbde${SHARED}: compat
129114731Sbde
130114731Sbde# Take care of stale directory-level symlinks.
131114731Sbdecompat:
132214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
133114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
134114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13554351Smarcel	fi
13654351Smarcel.endfor
137114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
138114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
139114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
140156813Sru.if ${MK_BIND_LIBS} != "no"
141135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
142135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
143135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
144135851Sdougb.endif
145114731Sbde
146114731Sbdecopies:
147144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
148214629Sjhb	${_MARCHS}
149114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
150114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
151114731Sbde	for h in *.h; do \
152114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
153114731Sbde	done
154114731Sbde.endif
155114731Sbde.endfor
156143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
15754351Smarcel	cd ${.CURDIR}/../sys; \
158114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
159114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
16054351Smarcel.endfor
161143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
162143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
163143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
164123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
165123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
166123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
167130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
168130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
170166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
171166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
172166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
173156813Sru.if ${MK_IPFILTER} != "no"
174116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
175116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
176116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
177145539Sscottl.endif
178126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
179126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
181143423Sume	cd ${.CURDIR}/../sys/crypto; \
182143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
183143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
184116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
185116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
186114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
187144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
188114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
189114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
190144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
191144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
192114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
19477857Sjlemon.endif
195214629Sjhb.for _MARCH in ${_MARCHS}
196214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
197144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
198144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
199144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
200144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
202144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
203144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
204144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
205144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
206144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
208144514Simp.endif
209144514Simp.endif
210214629Sjhb.endfor
211168677Spjd	cd ${.CURDIR}/../sys/rpc; \
212168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
213168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2141539Srgrimes
21554351Smarcelsymlinks:
21654351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
21756645Speter.for i in ${LDIRS}
218114731Sbde	cd ${.CURDIR}/../sys/$i; \
219114731Sbde	for h in *.h; do \
220114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
221114731Sbde	done
22254351Smarcel.endfor
223143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
224114731Sbde	cd ${.CURDIR}/../sys/$i; \
225114731Sbde	for h in *.h; do \
226114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
227114731Sbde	done
22877046Sru.endfor
229143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
230143013Snjl	for h in acpiio.h; do \
231143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
232143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
233143013Snjl	done
234142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
235142992Sru	for h in ioctl_*.h; do \
236142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
237142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
238142992Sru	done
239114731Sbde.for i in ${LSUBSUBDIRS}
240114731Sbde	cd ${.CURDIR}/../sys/$i; \
241114731Sbde	for h in *.h; do \
242114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
243114731Sbde	done
244114731Sbde.endfor
245130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
246130416Smlaier	for h in *.h; do \
247130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
248130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
249130416Smlaier	done
250156813Sru.if ${MK_IPFILTER} != "no"
251116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
252116734Sru	for h in *.h; do \
253116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
254116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
255116734Sru	done
256145539Sscottl.endif
257126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
258126385Smlaier	for h in *.h; do \
259126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
260126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
261126385Smlaier	done
262143423Sume	cd ${.CURDIR}/../sys/crypto; \
263143423Sume	for h in rijndael/rijndael.h; do \
264143423Sume		ln -fs ../../../sys/crypto/$$h \
265143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
266143423Sume	done
267114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
268114731Sbde	for h in *.h; do \
269114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
270114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
271114731Sbde	done
272144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
273114731Sbde	for h in *.h; do \
274144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
275114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
276114731Sbde	done
277144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
278144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
279114731Sbde	for h in *.h; do \
280144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
281114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
282114731Sbde	done
283114731Sbde.endif
284214629Sjhb.for _MARCH in ${_MARCHS}
285214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
286144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
287144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
288144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
289144514Simp	for h in *.h; do \
290144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
291144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
292144514Simp	done
293144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
294144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
295144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
296144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
297144514Simp	for h in *.h; do \
298144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
299144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
300144514Simp	done
301144514Simp.endif
302144514Simp.endif
303214629Sjhb.endfor
304166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
305166640Srodrigc	for h in *.h; do \
306166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
307166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
308166640Srodrigc	done
309168677Spjd	cd ${.CURDIR}/../sys/rpc; \
310168677Spjd	for h in types.h; do \
311168677Spjd		ln -fs ../../../sys/rpc/$$h \
312168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
313168677Spjd	done
314