Makefile revision 274001
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: stable/10/include/Makefile 274001 2014-11-03 03:17:58Z rpaulo $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
6156813Sru.include <bsd.own.mk>
7156813Sru
818420SbdeCLEANFILES= osreldate.h version vers.c
9267666StijlSUBDIR= arpa 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 \
13267666Stijl	fts.h ftw.h getopt.h glob.h grp.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 \
22251230Sed	signal.h spawn.h stab.h stdalign.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
36251230SedLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
37251230Sed	syslog.h ucontext.h
381539Srgrimes
39171453SrwatsonLDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
40252356Sdavide	netipsec ${_netipx} netnatm netsmb \
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 \
51252356Sdavide	fs/procfs fs/smbfs 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
71267666Stijl.if ${MK_GSSAPI} != "no"
72267666StijlSUBDIR+=	gssapi
73267666StijlINCS+=		gssapi.h
74267666Stijl.endif
75267666Stijl
76156813Sru.if ${MK_HESIOD} != "no"
77148796SphkINCS+=	hesiod.h
78148796Sphk.endif
79148796Sphk
80156813Sru.if ${MK_BLUETOOTH} != "no"
81178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
82125123Semax.endif
83107139Sjulian
84252356Sdavide# XXX unconditionally needed by <netsmb/netbios.h>
85156905Sru#.if ${MK_IPX} != "no"
86156905Sru_netipx=	netipx
87156905Sru#.endif
88156905Sru
89254273Speter# Handle the #define aliases for libiconv
90254273Speter.if ${MK_ICONV} == "yes"
91258230SgjbINCS+=		iconv.h
92254273Speter.endif
93254273Speter	
94254273Speter
9554351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
9654351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
9754351Smarcel# probably only useful for developers and should be avoided if you do not
9854351Smarcel# wish to tie your /usr/include and /usr/src together.
9954351Smarcel#SHARED=	symlinks
10054351SmarcelSHARED?=	copies
10154351Smarcel
10296462SruINCS+=	osreldate.h
10325734Speter
104255930SianSYSDIR=			${.CURDIR}/../sys
105255930SianNEWVERS_SH=		${SYSDIR}/conf/newvers.sh
106255930SianPARAM_H=		${SYSDIR}/sys/param.h
107255775SianMK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
10825734Speter
109255775Sianosreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
110255775Sian	env ECHO="${ECHO}" \
111255775Sian	    MAKE="${MAKE}" \
112255775Sian	    NEWVERS_SH=${NEWVERS_SH} \
113255775Sian	    PARAM_H=${PARAM_H} \
114255930Sian	    SYSDIR=${SYSDIR} \
115255807Sian	    sh ${MK_OSRELDATE_SH}
116255775Sian
11788055Sru.for i in ${LHDRS}
11896462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11917900Speter.endfor
12088055Sru.for i in ${MHDRS}
12196462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
12217900Speter.endfor
12388055Sru.for i in ${PHDRS}
124164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
12534030Sdufault.endfor
12654351Smarcel
127211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
128214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
129144514Simp.endif
130214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
131214629Sjhb_MARCHS+=	x86
132214629Sjhb.endif
133144514Simp
134114731Sbde.include <bsd.prog.mk>
135114731Sbde
136114731Sbdeinstallincludes: ${SHARED}
137114731Sbde${SHARED}: compat
138114731Sbde
139114731Sbde# Take care of stale directory-level symlinks.
140114731Sbdecompat:
141214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
142114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
143114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
14454351Smarcel	fi
14554351Smarcel.endfor
146114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
147114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
148114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
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
160246367Sjhb.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${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 \
167274001Srpaulo	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
168274001Srpaulo	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
169143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
170246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
171246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
172246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/agp
173123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
174123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
175123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
176235537Sgber.if ${MK_NAND} != "no"
177235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
178235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
179235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
180235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
181235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand
182235537Sgber.endif
183246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
184246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
185246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/pci
186130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
187130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
188130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
189166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
190166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
192156813Sru.if ${MK_IPFILTER} != "no"
193116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
194116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
196145539Sscottl.endif
197263370Sglebius.if ${MK_PF} != "no"
198263370Sglebius	cd ${.CURDIR}/../sys/netpfil/pf; \
199263370Sglebius	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
200263370Sglebius	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
201263370Sglebius.endif
202143423Sume	cd ${.CURDIR}/../sys/crypto; \
203143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
204143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
205116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
206116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
208144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
209114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
211144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
212144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
213114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
214114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
21577857Sjlemon.endif
216214629Sjhb.for _MARCH in ${_MARCHS}
217214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
218144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
219144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
220144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
221144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
222144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
223144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
224144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
225144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
226144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
227144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
228144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
229144514Simp.endif
230144514Simp.endif
231214629Sjhb.endfor
232168677Spjd	cd ${.CURDIR}/../sys/rpc; \
233168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
234168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2351539Srgrimes
23654351Smarcelsymlinks:
23754351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
23856645Speter.for i in ${LDIRS}
239114731Sbde	cd ${.CURDIR}/../sys/$i; \
240114731Sbde	for h in *.h; do \
241114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
242114731Sbde	done
24354351Smarcel.endfor
244246367Sjhb.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
245114731Sbde	cd ${.CURDIR}/../sys/$i; \
246114731Sbde	for h in *.h; do \
247114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
248114731Sbde	done
24977046Sru.endfor
250143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
251274001Srpaulo	for h in acpiio.h acpi_hpet.h; do \
252143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
253143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
254143013Snjl	done
255246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
256246367Sjhb	for h in agpreg.h; do \
257246367Sjhb		ln -fs ../../../../sys/dev/agp/$$h \
258246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
259246367Sjhb	done
260142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
261142992Sru	for h in ioctl_*.h; do \
262142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
263142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
264142992Sru	done
265235537Sgber.if ${MK_NAND} != "no"
266235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
267235537Sgber	for h in nandsim.h nand_dev.h; do \
268235537Sgber		ln -fs ../../../../sys/dev/nand/$$h \
269235537Sgber		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
270235537Sgber	done
271235537Sgber.endif
272246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
273246367Sjhb	for h in pcireg.h; do \
274246367Sjhb		ln -fs ../../../../sys/dev/pci/$$h \
275246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
276246367Sjhb	done
277114731Sbde.for i in ${LSUBSUBDIRS}
278114731Sbde	cd ${.CURDIR}/../sys/$i; \
279114731Sbde	for h in *.h; do \
280114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
281114731Sbde	done
282114731Sbde.endfor
283130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
284130416Smlaier	for h in *.h; do \
285130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
286130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
287130416Smlaier	done
288156813Sru.if ${MK_IPFILTER} != "no"
289116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
290116734Sru	for h in *.h; do \
291116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
292116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
293116734Sru	done
294145539Sscottl.endif
295263086Sglebius.if ${MK_PF} != "no"
296263086Sglebius	cd ${.CURDIR}/../sys/netpfil/pf; \
297263086Sglebius	for h in *.h; do \
298263086Sglebius		ln -fs ../../../../sys/netpfil/pf/$$h \
299263086Sglebius		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
300263086Sglebius	done
301263086Sglebius.endif
302143423Sume	cd ${.CURDIR}/../sys/crypto; \
303143423Sume	for h in rijndael/rijndael.h; do \
304143423Sume		ln -fs ../../../sys/crypto/$$h \
305143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
306143423Sume	done
307114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
308114731Sbde	for h in *.h; do \
309114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
310114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
311114731Sbde	done
312144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
313114731Sbde	for h in *.h; do \
314144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
315114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
316114731Sbde	done
317144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
318144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
319114731Sbde	for h in *.h; do \
320144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
321114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
322114731Sbde	done
323114731Sbde.endif
324214629Sjhb.for _MARCH in ${_MARCHS}
325214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
326144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
327144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
328144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
329144514Simp	for h in *.h; do \
330144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
331144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
332144514Simp	done
333144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
334144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
335144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
336144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
337144514Simp	for h in *.h; do \
338144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
339144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
340144514Simp	done
341144514Simp.endif
342144514Simp.endif
343214629Sjhb.endfor
344166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
345166640Srodrigc	for h in *.h; do \
346166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
347166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
348166640Srodrigc	done
349168677Spjd	cd ${.CURDIR}/../sys/rpc; \
350168677Spjd	for h in types.h; do \
351168677Spjd		ln -fs ../../../sys/rpc/$$h \
352168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
353168677Spjd	done
354