140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD$
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 \
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
71156813Sru.if ${MK_HESIOD} != "no"
72148796SphkINCS+=	hesiod.h
73148796Sphk.endif
74148796Sphk
75156813Sru.if ${MK_BLUETOOTH} != "no"
76178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
77125123Semax.endif
78107139Sjulian
79252356Sdavide# XXX unconditionally needed by <netsmb/netbios.h>
80156905Sru#.if ${MK_IPX} != "no"
81156905Sru_netipx=	netipx
82156905Sru#.endif
83156905Sru
84254273Speter# Handle the #define aliases for libiconv
85254273Speter.if ${MK_ICONV} == "yes"
86258230SgjbINCS+=		iconv.h
87254273Speter.endif
88254273Speter	
89254273Speter
9054351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
9154351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
9254351Smarcel# probably only useful for developers and should be avoided if you do not
9354351Smarcel# wish to tie your /usr/include and /usr/src together.
9454351Smarcel#SHARED=	symlinks
9554351SmarcelSHARED?=	copies
9654351Smarcel
9796462SruINCS+=	osreldate.h
9825734Speter
99255930SianSYSDIR=			${.CURDIR}/../sys
100255930SianNEWVERS_SH=		${SYSDIR}/conf/newvers.sh
101255930SianPARAM_H=		${SYSDIR}/sys/param.h
102255775SianMK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
10325734Speter
104255775Sianosreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
105255775Sian	env ECHO="${ECHO}" \
106255775Sian	    MAKE="${MAKE}" \
107255775Sian	    NEWVERS_SH=${NEWVERS_SH} \
108255775Sian	    PARAM_H=${PARAM_H} \
109255930Sian	    SYSDIR=${SYSDIR} \
110255807Sian	    sh ${MK_OSRELDATE_SH}
111255775Sian
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}
144114731Sbde
145114731Sbdecopies:
146144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
147214629Sjhb	${_MARCHS}
148114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
149114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
150114731Sbde	for h in *.h; do \
151114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
152114731Sbde	done
153114731Sbde.endif
154114731Sbde.endfor
155246367Sjhb.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
15654351Smarcel	cd ${.CURDIR}/../sys; \
157114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
158114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
15954351Smarcel.endfor
160143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
161143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
162143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
163246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
164246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
165246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/agp
166123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
167123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
168123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
169235537Sgber.if ${MK_NAND} != "no"
170235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
171235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
172235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
173235537Sgber	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
174235537Sgber	    ${DESTDIR}${INCLUDEDIR}/dev/nand
175235537Sgber.endif
176246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
177246367Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
178246367Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/pci
179130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
180130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
181130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
182166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
183166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
185156813Sru.if ${MK_IPFILTER} != "no"
186116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
187116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
188116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
189145539Sscottl.endif
190143423Sume	cd ${.CURDIR}/../sys/crypto; \
191143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
192143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
193116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
194116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
196144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
197114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
199144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
200144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
201114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
20377857Sjlemon.endif
204214629Sjhb.for _MARCH in ${_MARCHS}
205214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
206144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
207144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
208144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
209144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
211144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
212144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
213144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
214144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
215144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
216144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
217144514Simp.endif
218144514Simp.endif
219214629Sjhb.endfor
220168677Spjd	cd ${.CURDIR}/../sys/rpc; \
221168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
222168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2231539Srgrimes
22454351Smarcelsymlinks:
22554351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
22656645Speter.for i in ${LDIRS}
227114731Sbde	cd ${.CURDIR}/../sys/$i; \
228114731Sbde	for h in *.h; do \
229114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
230114731Sbde	done
23154351Smarcel.endfor
232246367Sjhb.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
233114731Sbde	cd ${.CURDIR}/../sys/$i; \
234114731Sbde	for h in *.h; do \
235114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
236114731Sbde	done
23777046Sru.endfor
238143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
239143013Snjl	for h in acpiio.h; do \
240143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
241143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
242143013Snjl	done
243246367Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
244246367Sjhb	for h in agpreg.h; do \
245246367Sjhb		ln -fs ../../../../sys/dev/agp/$$h \
246246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
247246367Sjhb	done
248142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
249142992Sru	for h in ioctl_*.h; do \
250142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
251142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
252142992Sru	done
253235537Sgber.if ${MK_NAND} != "no"
254235537Sgber	cd ${.CURDIR}/../sys/dev/nand; \
255235537Sgber	for h in nandsim.h nand_dev.h; do \
256235537Sgber		ln -fs ../../../../sys/dev/nand/$$h \
257235537Sgber		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
258235537Sgber	done
259235537Sgber.endif
260246367Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
261246367Sjhb	for h in pcireg.h; do \
262246367Sjhb		ln -fs ../../../../sys/dev/pci/$$h \
263246367Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
264246367Sjhb	done
265114731Sbde.for i in ${LSUBSUBDIRS}
266114731Sbde	cd ${.CURDIR}/../sys/$i; \
267114731Sbde	for h in *.h; do \
268114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
269114731Sbde	done
270114731Sbde.endfor
271130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
272130416Smlaier	for h in *.h; do \
273130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
274130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
275130416Smlaier	done
276156813Sru.if ${MK_IPFILTER} != "no"
277116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
278116734Sru	for h in *.h; do \
279116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
280116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
281116734Sru	done
282145539Sscottl.endif
283143423Sume	cd ${.CURDIR}/../sys/crypto; \
284143423Sume	for h in rijndael/rijndael.h; do \
285143423Sume		ln -fs ../../../sys/crypto/$$h \
286143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
287143423Sume	done
288114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
289114731Sbde	for h in *.h; do \
290114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
291114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
292114731Sbde	done
293144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
294114731Sbde	for h in *.h; do \
295144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
296114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
297114731Sbde	done
298144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
299144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
300114731Sbde	for h in *.h; do \
301144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
302114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
303114731Sbde	done
304114731Sbde.endif
305214629Sjhb.for _MARCH in ${_MARCHS}
306214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
307144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
308144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
309144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
310144514Simp	for h in *.h; do \
311144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
312144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
313144514Simp	done
314144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
315144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
316144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
317144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
318144514Simp	for h in *.h; do \
319144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
320144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
321144514Simp	done
322144514Simp.endif
323144514Simp.endif
324214629Sjhb.endfor
325166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
326166640Srodrigc	for h in *.h; do \
327166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
328166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
329166640Srodrigc	done
330168677Spjd	cd ${.CURDIR}/../sys/rpc; \
331168677Spjd	for h in types.h; do \
332168677Spjd		ln -fs ../../../sys/rpc/$$h \
333168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
334168677Spjd	done
335