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
9235785StheravenSUBDIR= 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 \
22293896Sglebius	signal.h spawn.h stab.h stdalign.h stdatomic.h stdbool.h stddef.h \
23290001Sglebius	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 \
26245439Sbrooks	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
27235785Stheraven	wchar.h wctype.h wordexp.h xlocale.h
281539Srgrimes
29245439Sbrooks.PATH: ${.CURDIR}/../contrib/libc-vis
30245439SbrooksINCS+=	vis.h
31245439Sbrooks
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 \
40171135Sgnn	netipsec ${_netipx} netnatm ${_netncp} netsmb \
41156905Sru	nfs nfsclient nfsserver \
42188642Snyan	sys vm
4317900Speter
44195534SscottlLSUBDIRS=	cam/ata cam/scsi \
45247566Sjhb	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
46247566Sjhb	dev/hwpmc \
47252222Sjimharris	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
48252222Sjimharris	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
49172397Sru	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
50192545Srmacklem	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \
51171023Srafan	${_fs_nwfs} fs/portalfs 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
75219019Sgabor.if ${MK_ICONV} != "no"
76219019SgaborINCS+=	iconv.h
77219019Sgabor.endif
78219019Sgabor
79156813Sru.if ${MK_BLUETOOTH} != "no"
80178818SjhbLSUBSUBDIRS+=	netgraph/bluetooth/include
81125123Semax.endif
82107139Sjulian
83156905Sru# XXX unconditionally needed by <netsmb/netbios.h>
84156905Sru#.if ${MK_IPX} != "no"
85156905Sru_netipx=	netipx
86156905Sru#.endif
87156905Sru
88156905Sru.if ${MK_NCP} != "no"
89156905Sru_netncp=	netncp
90156905Sru_fs_nwfs=	fs/nwfs
91156905Sru.endif
92156905Sru
9354351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
9454351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
9554351Smarcel# probably only useful for developers and should be avoided if you do not
9654351Smarcel# wish to tie your /usr/include and /usr/src together.
9754351Smarcel#SHARED=	symlinks
9854351SmarcelSHARED?=	copies
9954351Smarcel
10096462SruINCS+=	osreldate.h
10125734Speter
102256386SianSYSDIR=			${.CURDIR}/../sys
103256386SianNEWVERS_SH=		${SYSDIR}/conf/newvers.sh
104256386SianPARAM_H=		${SYSDIR}/sys/param.h
105256386SianMK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
10625734Speter
107256386Sianosreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
108256386Sian	env ECHO="${ECHO}" \
109256386Sian	    MAKE="${MAKE}" \
110256386Sian	    NEWVERS_SH=${NEWVERS_SH} \
111256386Sian	    PARAM_H=${PARAM_H} \
112256386Sian	    SYSDIR=${SYSDIR} \
113256386Sian	    sh ${MK_OSRELDATE_SH}
114256386Sian
11588055Sru.for i in ${LHDRS}
11696462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11717900Speter.endfor
11888055Sru.for i in ${MHDRS}
11996462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
12017900Speter.endfor
12188055Sru.for i in ${PHDRS}
122164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
12334030Sdufault.endfor
12454351Smarcel
125211725Simp.if ${MACHINE} != ${MACHINE_CPUARCH}
126214629Sjhb_MARCHS=	${MACHINE_CPUARCH}
127144514Simp.endif
128214629Sjhb.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
129214629Sjhb_MARCHS+=	x86
130214629Sjhb.endif
131144514Simp
132114731Sbde.include <bsd.prog.mk>
133114731Sbde
134114731Sbdeinstallincludes: ${SHARED}
135114731Sbde${SHARED}: compat
136114731Sbde
137114731Sbde# Take care of stale directory-level symlinks.
138114731Sbdecompat:
139214629Sjhb.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
140114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
141114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
14254351Smarcel	fi
14354351Smarcel.endfor
144114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
145114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
146114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
147156813Sru.if ${MK_BIND_LIBS} != "no"
148135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
149135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
150135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
151135851Sdougb.endif
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
163247566Sjhb.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr: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 \
170143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
171247566Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
172247566Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
173247566Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/agp
174123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
175123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
176123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
177247566Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
178247566Sjhb	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
179247566Sjhb	    ${DESTDIR}${INCLUDEDIR}/dev/pci
180130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
181130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
182130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
183166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
184166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
185166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
186156813Sru.if ${MK_IPFILTER} != "no"
187116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
188116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
189116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
190145539Sscottl.endif
191126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
192126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
194143423Sume	cd ${.CURDIR}/../sys/crypto; \
195143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
196143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
197116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
198116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
199114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
200144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
201114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
203144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
204144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
205114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
206114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
20777857Sjlemon.endif
208214629Sjhb.for _MARCH in ${_MARCHS}
209214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
210144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
211144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
212144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
213144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
214144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
215144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
216144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
217144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
218144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
219144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
220144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
221144514Simp.endif
222144514Simp.endif
223214629Sjhb.endfor
224168677Spjd	cd ${.CURDIR}/../sys/rpc; \
225168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
226168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2271539Srgrimes
22854351Smarcelsymlinks:
22954351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
23056645Speter.for i in ${LDIRS}
231114731Sbde	cd ${.CURDIR}/../sys/$i; \
232114731Sbde	for h in *.h; do \
233114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
234114731Sbde	done
23554351Smarcel.endfor
236247566Sjhb.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/pci}
237114731Sbde	cd ${.CURDIR}/../sys/$i; \
238114731Sbde	for h in *.h; do \
239114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
240114731Sbde	done
24177046Sru.endfor
242143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
243143013Snjl	for h in acpiio.h; do \
244143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
245143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
246143013Snjl	done
247247566Sjhb	cd ${.CURDIR}/../sys/dev/agp; \
248247566Sjhb	for h in agpreg.h; do \
249247566Sjhb		ln -fs ../../../../sys/dev/agp/$$h \
250247566Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
251247566Sjhb	done
252142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
253142992Sru	for h in ioctl_*.h; do \
254142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
255142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
256142992Sru	done
257247566Sjhb	cd ${.CURDIR}/../sys/dev/pci; \
258247566Sjhb	for h in pcireg.h; do \
259247566Sjhb		ln -fs ../../../../sys/dev/pci/$$h \
260247566Sjhb		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
261247566Sjhb	done
262114731Sbde.for i in ${LSUBSUBDIRS}
263114731Sbde	cd ${.CURDIR}/../sys/$i; \
264114731Sbde	for h in *.h; do \
265114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
266114731Sbde	done
267114731Sbde.endfor
268130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
269130416Smlaier	for h in *.h; do \
270130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
271130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
272130416Smlaier	done
273156813Sru.if ${MK_IPFILTER} != "no"
274116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
275116734Sru	for h in *.h; do \
276116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
277116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
278116734Sru	done
279145539Sscottl.endif
280126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
281126385Smlaier	for h in *.h; do \
282126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
283126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
284126385Smlaier	done
285143423Sume	cd ${.CURDIR}/../sys/crypto; \
286143423Sume	for h in rijndael/rijndael.h; do \
287143423Sume		ln -fs ../../../sys/crypto/$$h \
288143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
289143423Sume	done
290114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
291114731Sbde	for h in *.h; do \
292114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
293114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
294114731Sbde	done
295144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
296114731Sbde	for h in *.h; do \
297144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
298114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
299114731Sbde	done
300144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
301144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
302114731Sbde	for h in *.h; do \
303144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
304114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
305114731Sbde	done
306114731Sbde.endif
307214629Sjhb.for _MARCH in ${_MARCHS}
308214629Sjhb.if exists(${.CURDIR}/../sys/${_MARCH}/include)
309144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
310144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
311144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
312144514Simp	for h in *.h; do \
313144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
314144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
315144514Simp	done
316144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
317144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
318144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
319144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
320144514Simp	for h in *.h; do \
321144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
322144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
323144514Simp	done
324144514Simp.endif
325144514Simp.endif
326214629Sjhb.endfor
327166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
328166640Srodrigc	for h in *.h; do \
329166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
330166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
331166640Srodrigc	done
332168677Spjd	cd ${.CURDIR}/../sys/rpc; \
333168677Spjd	for h in types.h; do \
334168677Spjd		ln -fs ../../../sys/rpc/$$h \
335168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
336168677Spjd	done
337