Makefile revision 280427
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: stable/10/include/Makefile 280427 2015-03-24 08:24:55Z ngie $
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 \
49280419Sngie	dev/speaker 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
63280427Sngie.if ${MK_BLUETOOTH} != "no"
64280427SngieLSUBSUBDIRS+=	netgraph/bluetooth/include
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
80252356Sdavide# XXX unconditionally needed by <netsmb/netbios.h>
81156905Sru#.if ${MK_IPX} != "no"
82156905Sru_netipx=	netipx
83156905Sru#.endif
84156905Sru
85254273Speter# Handle the #define aliases for libiconv
86254273Speter.if ${MK_ICONV} == "yes"
87258230SgjbINCS+=		iconv.h
88254273Speter.endif
89254273Speter
90280427Sngie.if ${MK_USB} != "no"
91280427SngieLSUBDIRS+=	dev/usb
92280427Sngie.endif
93280427Sngie
94280427Sngie.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
95280427Sngie_dev_powermac_nvram=	dev/powermac_nvram
96280427Sngie.endif
97280427Sngie
9854351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
9954351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
10054351Smarcel# probably only useful for developers and should be avoided if you do not
10154351Smarcel# wish to tie your /usr/include and /usr/src together.
10254351Smarcel#SHARED=	symlinks
10354351SmarcelSHARED?=	copies
10454351Smarcel
10596462SruINCS+=	osreldate.h
10625734Speter
107255930SianSYSDIR=			${.CURDIR}/../sys
108255930SianNEWVERS_SH=		${SYSDIR}/conf/newvers.sh
109255930SianPARAM_H=		${SYSDIR}/sys/param.h
110255775SianMK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
11125734Speter
112255775Sianosreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
113255775Sian	env ECHO="${ECHO}" \
114255775Sian	    MAKE="${MAKE}" \
115255775Sian	    NEWVERS_SH=${NEWVERS_SH} \
116255775Sian	    PARAM_H=${PARAM_H} \
117255930Sian	    SYSDIR=${SYSDIR} \
118255807Sian	    sh ${MK_OSRELDATE_SH}
119255775Sian
12088055Sru.for i in ${LHDRS}
12196462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
12217900Speter.endfor
12388055Sru.for i in ${MHDRS}
12496462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
12517900Speter.endfor
12688055Sru.for i in ${PHDRS}
127164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
12834030Sdufault.endfor
12954351Smarcel
130211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
131214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
132144514Simp.endif
133214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
134214629Sjhb_MARCHS+=	x86
135214629Sjhb.endif
136144514Simp
137114731Sbde.include <bsd.prog.mk>
138114731Sbde
139114731Sbdeinstallincludes: ${SHARED}
140114731Sbde${SHARED}: compat
141114731Sbde
142114731Sbde# Take care of stale directory-level symlinks.
143114731Sbdecompat:
144214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
145114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
146114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
14754351Smarcel	fi
14854351Smarcel.endfor
149114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
150114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
151114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
152114731Sbde
153114731Sbdecopies:
154144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
155214629Sjhb	${_MARCHS}
156114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
157114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
158114731Sbde	for h in *.h; do \
159114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
160114731Sbde	done
161114731Sbde.endif
162114731Sbde.endfor
163246367Sjhb.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
16454351Smarcel	cd ${.CURDIR}/../sys; \
165114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
166114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
16754351Smarcel.endfor
168143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
169143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
170274001Srpaulo	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
171274001Srpaulo	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
172143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
173246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
174246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
175246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/agp
176123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
177123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
178123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
179235537Sgber.if ${MK_NAND} != "no"
180235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
181235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
182235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
183235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
184235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand
185235537Sgber.endif
186246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
187246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
188246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/pci
189130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
190130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
192166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
193166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
194166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
195156813Sru.if ${MK_IPFILTER} != "no"
196116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
197116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
199145539Sscottl.endif
200263370Sglebius.if ${MK_PF} != "no"
201263370Sglebius	cd ${.CURDIR}/../sys/netpfil/pf; \
202263370Sglebius	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
203263370Sglebius	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
204263370Sglebius.endif
205143423Sume	cd ${.CURDIR}/../sys/crypto; \
206143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
207143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
208116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
209116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
211144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
212114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
213114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
214144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
215144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
216114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
217114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
21877857Sjlemon.endif
219214629Sjhb.for _MARCH in ${_MARCHS}
220214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
221144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
222144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
223144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
224144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
225144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
226144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
227144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
228144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
229144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
230144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
231144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
232144514Simp.endif
233144514Simp.endif
234214629Sjhb.endfor
235168677Spjd	cd ${.CURDIR}/../sys/rpc; \
236168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
237168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2381539Srgrimes
23954351Smarcelsymlinks:
24054351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
24156645Speter.for i in ${LDIRS}
242114731Sbde	cd ${.CURDIR}/../sys/$i; \
243114731Sbde	for h in *.h; do \
244114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
245114731Sbde	done
24654351Smarcel.endfor
247246367Sjhb.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
248114731Sbde	cd ${.CURDIR}/../sys/$i; \
249114731Sbde	for h in *.h; do \
250114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
251114731Sbde	done
25277046Sru.endfor
253143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
254274001Srpaulo	for h in acpiio.h acpi_hpet.h; do \
255143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
256143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
257143013Snjl	done
258246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
259246367Sjhb	for h in agpreg.h; do \
260246367Sjhb		ln -fs ../../../../sys/dev/agp/$$h \
261246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
262246367Sjhb	done
263142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
264142992Sru	for h in ioctl_*.h; do \
265142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
266142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
267142992Sru	done
268235537Sgber.if ${MK_NAND} != "no"
269235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
270235537Sgber	for h in nandsim.h nand_dev.h; do \
271235537Sgber		ln -fs ../../../../sys/dev/nand/$$h \
272235537Sgber		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
273235537Sgber	done
274235537Sgber.endif
275246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
276246367Sjhb	for h in pcireg.h; do \
277246367Sjhb		ln -fs ../../../../sys/dev/pci/$$h \
278246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
279246367Sjhb	done
280114731Sbde.for i in ${LSUBSUBDIRS}
281114731Sbde	cd ${.CURDIR}/../sys/$i; \
282114731Sbde	for h in *.h; do \
283114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
284114731Sbde	done
285114731Sbde.endfor
286130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
287130416Smlaier	for h in *.h; do \
288130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
289130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
290130416Smlaier	done
291156813Sru.if ${MK_IPFILTER} != "no"
292116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
293116734Sru	for h in *.h; do \
294116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
295116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
296116734Sru	done
297145539Sscottl.endif
298263086Sglebius.if ${MK_PF} != "no"
299263086Sglebius	cd ${.CURDIR}/../sys/netpfil/pf; \
300263086Sglebius	for h in *.h; do \
301263086Sglebius		ln -fs ../../../../sys/netpfil/pf/$$h \
302263086Sglebius		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
303263086Sglebius	done
304263086Sglebius.endif
305143423Sume	cd ${.CURDIR}/../sys/crypto; \
306143423Sume	for h in rijndael/rijndael.h; do \
307143423Sume		ln -fs ../../../sys/crypto/$$h \
308143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
309143423Sume	done
310114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
311114731Sbde	for h in *.h; do \
312114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
313114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
314114731Sbde	done
315144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
316114731Sbde	for h in *.h; do \
317144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
318114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
319114731Sbde	done
320144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
321144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
322114731Sbde	for h in *.h; do \
323144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
324114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
325114731Sbde	done
326114731Sbde.endif
327214629Sjhb.for _MARCH in ${_MARCHS}
328214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
329144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
330144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
331144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
332144514Simp	for h in *.h; do \
333144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
334144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
335144514Simp	done
336144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
337144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
338144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
339144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
340144514Simp	for h in *.h; do \
341144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
342144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
343144514Simp	done
344144514Simp.endif
345144514Simp.endif
346214629Sjhb.endfor
347166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
348166640Srodrigc	for h in *.h; do \
349166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
350166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
351166640Srodrigc	done
352168677Spjd	cd ${.CURDIR}/../sys/rpc; \
353168677Spjd	for h in types.h; do \
354168677Spjd		ln -fs ../../../sys/rpc/$$h \
355168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
356168677Spjd	done
357