Makefile revision 250883
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 250883 2013-05-21 19:59:37Z ed $
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 \
26250883Sed	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
27232498Stheraven	wchar.h wctype.h wordexp.h xlocale.h
281539Srgrimes
29244401Sbrooks.PATH: ${.CURDIR}/../contrib/libc-vis
30244401SbrooksINCS+=	vis.h
31244401Sbrooks
32119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
3334030Sdufault
34201546SdavidxuPHDRS=	sched.h _semaphore.h
3534030Sdufault
3688055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
37199898Sed	ucontext.h
381539Srgrimes
39171453SrwatsonLDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
40241680Sattilio	netipsec ${_netipx} netnatm \
41156905Sru	nfs nfsclient nfsserver \
42188642Snyan	sys vm
4317900Speter
44195534SscottlLSUBDIRS=	cam/ata cam/scsi \
45246367Sjhb	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
46246367Sjhb	dev/hwpmc \
47240621Sjimharris	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
48246367Sjhb	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
49172397Sru	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
50241636Sattilio	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
51241680Sattilio	fs/procfs fs/udf fs/unionfs \
52163851Spjd	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
53202437Strasz	geom/mirror geom/mountver geom/multipath geom/nop \
54219974Smav	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
55135339Sglebius	netgraph/atm netgraph/netflow \
56156885Srwatson	security/audit \
57135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
58135339Sglebius	security/mac_mls security/mac_partition \
59137556Smarkm	ufs/ffs ufs/ufs
6077031Sru
61192901SthompsaLSUBSUBDIRS=	dev/mpt/mpilib
62178818Sjhb
63210024Snwhitehorn.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
64160892Ssobomax_dev_powermac_nvram=	dev/powermac_nvram
65160892Ssobomax.endif
66160892Ssobomax
67156813Sru.if ${MK_GPIB} != "no"
68141397Sphk_dev_ieee488=	dev/ieee488
69141397Sphk.endif
70141397Sphk
71156813Sru.if ${MK_HESIOD} != "no"
72148796SphkINCS+=	hesiod.h
73148796Sphk.endif
74148796Sphk
75219019Sgabor.if ${MK_ICONV} != "no"
76219019SgaborINCS+=	iconv.h
77219019Sgabor.endif
78219019Sgabor
79156813Sru.if ${MK_BLUETOOTH} != "no"
80178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
81125123Semax.endif
82107139Sjulian
83156905Sru#.if ${MK_IPX} != "no"
84156905Sru_netipx=	netipx
85156905Sru#.endif
86156905Sru
8754351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
8854351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
8954351Smarcel# probably only useful for developers and should be avoided if you do not
9054351Smarcel# wish to tie your /usr/include and /usr/src together.
9154351Smarcel#SHARED=	symlinks
9254351SmarcelSHARED?=	copies
9354351Smarcel
9496462SruINCS+=	osreldate.h
9525734Speter
96156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
97156532Sru    ${.CURDIR}/Makefile
9825734Speter	@${ECHO} creating osreldate.h from newvers.sh
99156532Sru	@MAKE=${MAKE}; \
100156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
101156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
102156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
103156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
104156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
105156531Sru	echo "#else" >> osreldate.h; \
106156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
107156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
108183390Speter	echo "#endif" >> osreldate.h
10925734Speter
11088055Sru.for i in ${LHDRS}
11196462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11217900Speter.endfor
11388055Sru.for i in ${MHDRS}
11496462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11517900Speter.endfor
11688055Sru.for i in ${PHDRS}
117164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11834030Sdufault.endfor
11954351Smarcel
120211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
121214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
122144514Simp.endif
123214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
124214629Sjhb_MARCHS+=	x86
125214629Sjhb.endif
126144514Simp
127114731Sbde.include <bsd.prog.mk>
128114731Sbde
129114731Sbdeinstallincludes: ${SHARED}
130114731Sbde${SHARED}: compat
131114731Sbde
132114731Sbde# Take care of stale directory-level symlinks.
133114731Sbdecompat:
134214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
135114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
136114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13754351Smarcel	fi
13854351Smarcel.endfor
139114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
140114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
141114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
142156813Sru.if ${MK_BIND_LIBS} != "no"
143135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
144135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
145135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
146135851Sdougb.endif
147114731Sbde
148114731Sbdecopies:
149144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
150214629Sjhb	${_MARCHS}
151114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
152114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
153114731Sbde	for h in *.h; do \
154114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
155114731Sbde	done
156114731Sbde.endif
157114731Sbde.endfor
158246367Sjhb.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
15954351Smarcel	cd ${.CURDIR}/../sys; \
160114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
161114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
16254351Smarcel.endfor
163143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
164143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
165143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
166246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
167246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
168246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/agp
169123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
170123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
171123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
172235537Sgber.if ${MK_NAND} != "no"
173235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
174235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
175235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
176235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
177235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand
178235537Sgber.endif
179246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
180246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
181246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/pci
182130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
183130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
185166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
186166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
187166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
188156813Sru.if ${MK_IPFILTER} != "no"
189116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
190116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
192145539Sscottl.endif
193143423Sume	cd ${.CURDIR}/../sys/crypto; \
194143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
195143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
196116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
197116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
199144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
200114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
202144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
203144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
204114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
205114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
20677857Sjlemon.endif
207214629Sjhb.for _MARCH in ${_MARCHS}
208214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
209144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
210144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
211144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
212144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
213144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
214144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
215144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
216144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
217144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
218144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
219144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
220144514Simp.endif
221144514Simp.endif
222214629Sjhb.endfor
223168677Spjd	cd ${.CURDIR}/../sys/rpc; \
224168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
225168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2261539Srgrimes
22754351Smarcelsymlinks:
22854351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
22956645Speter.for i in ${LDIRS}
230114731Sbde	cd ${.CURDIR}/../sys/$i; \
231114731Sbde	for h in *.h; do \
232114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
233114731Sbde	done
23454351Smarcel.endfor
235246367Sjhb.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
236114731Sbde	cd ${.CURDIR}/../sys/$i; \
237114731Sbde	for h in *.h; do \
238114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
239114731Sbde	done
24077046Sru.endfor
241143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
242143013Snjl	for h in acpiio.h; do \
243143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
244143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
245143013Snjl	done
246246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
247246367Sjhb	for h in agpreg.h; do \
248246367Sjhb		ln -fs ../../../../sys/dev/agp/$$h \
249246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
250246367Sjhb	done
251142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
252142992Sru	for h in ioctl_*.h; do \
253142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
254142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
255142992Sru	done
256235537Sgber.if ${MK_NAND} != "no"
257235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
258235537Sgber	for h in nandsim.h nand_dev.h; do \
259235537Sgber		ln -fs ../../../../sys/dev/nand/$$h \
260235537Sgber		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
261235537Sgber	done
262235537Sgber.endif
263246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
264246367Sjhb	for h in pcireg.h; do \
265246367Sjhb		ln -fs ../../../../sys/dev/pci/$$h \
266246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
267246367Sjhb	done
268114731Sbde.for i in ${LSUBSUBDIRS}
269114731Sbde	cd ${.CURDIR}/../sys/$i; \
270114731Sbde	for h in *.h; do \
271114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
272114731Sbde	done
273114731Sbde.endfor
274130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
275130416Smlaier	for h in *.h; do \
276130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
277130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
278130416Smlaier	done
279156813Sru.if ${MK_IPFILTER} != "no"
280116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
281116734Sru	for h in *.h; do \
282116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
283116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
284116734Sru	done
285145539Sscottl.endif
286143423Sume	cd ${.CURDIR}/../sys/crypto; \
287143423Sume	for h in rijndael/rijndael.h; do \
288143423Sume		ln -fs ../../../sys/crypto/$$h \
289143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
290143423Sume	done
291114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
292114731Sbde	for h in *.h; do \
293114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
294114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
295114731Sbde	done
296144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
297114731Sbde	for h in *.h; do \
298144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
299114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
300114731Sbde	done
301144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
302144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
303114731Sbde	for h in *.h; do \
304144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
305114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
306114731Sbde	done
307114731Sbde.endif
308214629Sjhb.for _MARCH in ${_MARCHS}
309214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
310144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
311144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
312144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
313144514Simp	for h in *.h; do \
314144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
315144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
316144514Simp	done
317144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
318144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
319144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
320144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
321144514Simp	for h in *.h; do \
322144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
323144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
324144514Simp	done
325144514Simp.endif
326144514Simp.endif
327214629Sjhb.endfor
328166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
329166640Srodrigc	for h in *.h; do \
330166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
331166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
332166640Srodrigc	done
333168677Spjd	cd ${.CURDIR}/../sys/rpc; \
334168677Spjd	for h in types.h; do \
335168677Spjd		ln -fs ../../../sys/rpc/$$h \
336168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
337168677Spjd	done
338