Makefile revision 219974
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 219974 2011-03-24 21:31:32Z mav $
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 \
43218772Skib	dev/ic dev/iicbus ${_dev_ieee488} dev/io 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 \
50219974Smav	geom/raid 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
71219019Sgabor.if ${MK_ICONV} != "no"
72219019SgaborINCS+=	iconv.h
73219019Sgabor.endif
74219019Sgabor
75156813Sru.if ${MK_BLUETOOTH} != "no"
76178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
77125123Semax.endif
78107139Sjulian
79156905Sru# XXX unconditionally needed by <netsmb/netbios.h>
80156905Sru#.if ${MK_IPX} != "no"
81156905Sru_netipx=	netipx
82156905Sru#.endif
83156905Sru
84156905Sru.if ${MK_NCP} != "no"
85156905Sru_netncp=	netncp
86156905Sru_fs_nwfs=	fs/nwfs
87156905Sru.endif
88156905Sru
8954351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
9054351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
9154351Smarcel# probably only useful for developers and should be avoided if you do not
9254351Smarcel# wish to tie your /usr/include and /usr/src together.
9354351Smarcel#SHARED=	symlinks
9454351SmarcelSHARED?=	copies
9554351Smarcel
9696462SruINCS+=	osreldate.h
9725734Speter
98156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
99156532Sru    ${.CURDIR}/Makefile
10025734Speter	@${ECHO} creating osreldate.h from newvers.sh
101156532Sru	@MAKE=${MAKE}; \
102156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
103156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
104156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
105156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
106156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
107156531Sru	echo "#else" >> osreldate.h; \
108156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
109156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
110183390Speter	echo "#endif" >> osreldate.h
11125734Speter
11288055Sru.for i in ${LHDRS}
11396462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11417900Speter.endfor
11588055Sru.for i in ${MHDRS}
11696462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11717900Speter.endfor
11888055Sru.for i in ${PHDRS}
119164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
12034030Sdufault.endfor
12154351Smarcel
122211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
123214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
124144514Simp.endif
125214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
126214629Sjhb_MARCHS+=	x86
127214629Sjhb.endif
128144514Simp
129114731Sbde.include <bsd.prog.mk>
130114731Sbde
131114731Sbdeinstallincludes: ${SHARED}
132114731Sbde${SHARED}: compat
133114731Sbde
134114731Sbde# Take care of stale directory-level symlinks.
135114731Sbdecompat:
136214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
137114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
138114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13954351Smarcel	fi
14054351Smarcel.endfor
141114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
142114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
143114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
144156813Sru.if ${MK_BIND_LIBS} != "no"
145135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
146135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
147135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
148135851Sdougb.endif
149114731Sbde
150114731Sbdecopies:
151144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
152214629Sjhb	${_MARCHS}
153114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
154114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
155114731Sbde	for h in *.h; do \
156114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
157114731Sbde	done
158114731Sbde.endif
159114731Sbde.endfor
160143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
16154351Smarcel	cd ${.CURDIR}/../sys; \
162114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
163114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
16454351Smarcel.endfor
165143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
166143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
167143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
168123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
169123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
170123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
171130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
172130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
174166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
175166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
176166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
177156813Sru.if ${MK_IPFILTER} != "no"
178116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
179116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
181145539Sscottl.endif
182126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
183126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
185143423Sume	cd ${.CURDIR}/../sys/crypto; \
186143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
187143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
188116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
189116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
190114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
191144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
192114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
194144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
195144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
196114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
19877857Sjlemon.endif
199214629Sjhb.for _MARCH in ${_MARCHS}
200214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
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
214214629Sjhb.endfor
215168677Spjd	cd ${.CURDIR}/../sys/rpc; \
216168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
217168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2181539Srgrimes
21954351Smarcelsymlinks:
22054351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
22156645Speter.for i in ${LDIRS}
222114731Sbde	cd ${.CURDIR}/../sys/$i; \
223114731Sbde	for h in *.h; do \
224114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
225114731Sbde	done
22654351Smarcel.endfor
227143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
228114731Sbde	cd ${.CURDIR}/../sys/$i; \
229114731Sbde	for h in *.h; do \
230114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
231114731Sbde	done
23277046Sru.endfor
233143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
234143013Snjl	for h in acpiio.h; do \
235143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
236143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
237143013Snjl	done
238142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
239142992Sru	for h in ioctl_*.h; do \
240142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
241142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
242142992Sru	done
243114731Sbde.for i in ${LSUBSUBDIRS}
244114731Sbde	cd ${.CURDIR}/../sys/$i; \
245114731Sbde	for h in *.h; do \
246114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
247114731Sbde	done
248114731Sbde.endfor
249130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
250130416Smlaier	for h in *.h; do \
251130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
252130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
253130416Smlaier	done
254156813Sru.if ${MK_IPFILTER} != "no"
255116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
256116734Sru	for h in *.h; do \
257116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
258116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
259116734Sru	done
260145539Sscottl.endif
261126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
262126385Smlaier	for h in *.h; do \
263126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
264126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
265126385Smlaier	done
266143423Sume	cd ${.CURDIR}/../sys/crypto; \
267143423Sume	for h in rijndael/rijndael.h; do \
268143423Sume		ln -fs ../../../sys/crypto/$$h \
269143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
270143423Sume	done
271114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
272114731Sbde	for h in *.h; do \
273114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
274114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
275114731Sbde	done
276144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
277114731Sbde	for h in *.h; do \
278144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
279114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
280114731Sbde	done
281144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
282144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
283114731Sbde	for h in *.h; do \
284144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
285114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
286114731Sbde	done
287114731Sbde.endif
288214629Sjhb.for _MARCH in ${_MARCHS}
289214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
290144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
291144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
292144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
293144514Simp	for h in *.h; do \
294144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
295144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
296144514Simp	done
297144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
298144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
299144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
300144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
301144514Simp	for h in *.h; do \
302144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
303144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
304144514Simp	done
305144514Simp.endif
306144514Simp.endif
307214629Sjhb.endfor
308166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
309166640Srodrigc	for h in *.h; do \
310166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
311166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
312166640Srodrigc	done
313168677Spjd	cd ${.CURDIR}/../sys/rpc; \
314168677Spjd	for h in types.h; do \
315168677Spjd		ln -fs ../../../sys/rpc/$$h \
316168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
317168677Spjd	done
318