Makefile revision 241680
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 241680 2012-10-18 12:04:56Z attilio $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
6156813Sru.include <bsd.own.mk>
7156813Sru
818420SbdeCLEANFILES= osreldate.h version vers.c
9232498StheravenSUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
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 \
14220370Sobrien	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 \
22228879Sed	signal.h spawn.h stab.h stdalign.h stdatomic.h stdbool.h stddef.h \
23228879Sed	stdnoreturn.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 \
27232498Stheraven	wchar.h wctype.h wordexp.h xlocale.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 \
37241680Sattilio	netipsec ${_netipx} netnatm \
38156905Sru	nfs nfsclient nfsserver \
39188642Snyan	sys vm
4017900Speter
41195534SscottlLSUBDIRS=	cam/ata cam/scsi \
42237279Sobrien	dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \
43240621Sjimharris	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
44240621Sjimharris	dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
45172397Sru	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
46241636Sattilio	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
47241680Sattilio	fs/procfs 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#.if ${MK_IPX} != "no"
80156905Sru_netipx=	netipx
81156905Sru#.endif
82156905Sru
8354351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
8454351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
8554351Smarcel# probably only useful for developers and should be avoided if you do not
8654351Smarcel# wish to tie your /usr/include and /usr/src together.
8754351Smarcel#SHARED=	symlinks
8854351SmarcelSHARED?=	copies
8954351Smarcel
9096462SruINCS+=	osreldate.h
9125734Speter
92156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
93156532Sru    ${.CURDIR}/Makefile
9425734Speter	@${ECHO} creating osreldate.h from newvers.sh
95156532Sru	@MAKE=${MAKE}; \
96156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
97156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
98156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
99156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
100156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
101156531Sru	echo "#else" >> osreldate.h; \
102156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
103156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
104183390Speter	echo "#endif" >> osreldate.h
10525734Speter
10688055Sru.for i in ${LHDRS}
10796462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
10817900Speter.endfor
10988055Sru.for i in ${MHDRS}
11096462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11117900Speter.endfor
11288055Sru.for i in ${PHDRS}
113164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11434030Sdufault.endfor
11554351Smarcel
116211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
117214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
118144514Simp.endif
119214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
120214629Sjhb_MARCHS+=	x86
121214629Sjhb.endif
122144514Simp
123114731Sbde.include <bsd.prog.mk>
124114731Sbde
125114731Sbdeinstallincludes: ${SHARED}
126114731Sbde${SHARED}: compat
127114731Sbde
128114731Sbde# Take care of stale directory-level symlinks.
129114731Sbdecompat:
130214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} 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 \
146214629Sjhb	${_MARCHS}
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
154235537Sgber.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${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
165235537Sgber.if ${MK_NAND} != "no"
166235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
167235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
168235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
169235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
170235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand
171235537Sgber.endif
172130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
173130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
174130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
175166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
176166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
177166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
178156813Sru.if ${MK_IPFILTER} != "no"
179116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
180116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
181116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
182145539Sscottl.endif
183143423Sume	cd ${.CURDIR}/../sys/crypto; \
184143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
185143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
186116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
187116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
188114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
189144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
190114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
192144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
193144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
194114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
19677857Sjlemon.endif
197214629Sjhb.for _MARCH in ${_MARCHS}
198214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
199144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
200144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
201144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
202144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
203144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
204144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
205144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
206144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
207144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
208144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
209144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
210144514Simp.endif
211144514Simp.endif
212214629Sjhb.endfor
213168677Spjd	cd ${.CURDIR}/../sys/rpc; \
214168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
215168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2161539Srgrimes
21754351Smarcelsymlinks:
21854351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
21956645Speter.for i in ${LDIRS}
220114731Sbde	cd ${.CURDIR}/../sys/$i; \
221114731Sbde	for h in *.h; do \
222114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
223114731Sbde	done
22454351Smarcel.endfor
225235537Sgber.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand}
226114731Sbde	cd ${.CURDIR}/../sys/$i; \
227114731Sbde	for h in *.h; do \
228114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
229114731Sbde	done
23077046Sru.endfor
231143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
232143013Snjl	for h in acpiio.h; do \
233143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
234143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
235143013Snjl	done
236142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
237142992Sru	for h in ioctl_*.h; do \
238142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
239142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
240142992Sru	done
241235537Sgber.if ${MK_NAND} != "no"
242235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
243235537Sgber	for h in nandsim.h nand_dev.h; do \
244235537Sgber		ln -fs ../../../../sys/dev/nand/$$h \
245235537Sgber		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
246235537Sgber	done
247235537Sgber.endif
248114731Sbde.for i in ${LSUBSUBDIRS}
249114731Sbde	cd ${.CURDIR}/../sys/$i; \
250114731Sbde	for h in *.h; do \
251114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
252114731Sbde	done
253114731Sbde.endfor
254130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
255130416Smlaier	for h in *.h; do \
256130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
257130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
258130416Smlaier	done
259156813Sru.if ${MK_IPFILTER} != "no"
260116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
261116734Sru	for h in *.h; do \
262116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
263116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
264116734Sru	done
265145539Sscottl.endif
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