1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: stable/10/include/Makefile 318198 2017-05-11 21:01:02Z marius $
3#
4# Doing a "make install" builds /usr/include.
5
6.include <bsd.own.mk>
7
8CLEANFILES= osreldate.h version
9SUBDIR= arpa protocols rpcsvc rpc xlocale
10SUBDIR_PARALLEL=
11INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
12	db.h \
13	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
14	fts.h ftw.h getopt.h glob.h grp.h \
15	ieeefp.h ifaddrs.h \
16	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
17	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
18	ndbm.h netconfig.h \
19	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
20	printf.h proc_service.h pthread.h \
21	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
22	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
23	signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
24	stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
25	strings.h sysexits.h tar.h termios.h tgmath.h \
26	time.h timeconv.h timers.h ttyent.h \
27	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
28	wchar.h wctype.h wordexp.h xlocale.h
29
30.PATH: ${.CURDIR}/../contrib/libc-vis
31INCS+=	vis.h
32
33MHDRS=	float.h floatingpoint.h stdarg.h
34
35PHDRS=	sched.h _semaphore.h
36
37LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
38	syslog.h ucontext.h
39
40LDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
41	netipsec ${_netipx} netnatm netsmb \
42	nfs nfsclient nfsserver \
43	sys vm
44
45LSUBDIRS=	cam/ata cam/scsi \
46	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
47	dev/hwpmc dev/hyperv \
48	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/mmc \
49	dev/nvme \
50	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
51	dev/speaker dev/utopia dev/vkbd dev/wi \
52	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
53	fs/procfs fs/smbfs fs/udf fs/unionfs \
54	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
55	geom/mirror geom/mountver geom/multipath geom/nop \
56	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
57	netgraph/atm netgraph/netflow \
58	security/audit \
59	security/mac_biba security/mac_bsdextended security/mac_lomac \
60	security/mac_mls security/mac_partition \
61	ufs/ffs ufs/ufs
62
63LSUBSUBDIRS=	dev/mpt/mpilib
64
65.if ${MK_BLUETOOTH} != "no"
66LSUBSUBDIRS+=	netgraph/bluetooth/include
67.endif
68
69.if ${MK_GPIB} != "no"
70_dev_ieee488=	dev/ieee488
71.endif
72
73.if ${MK_GSSAPI} != "no"
74SUBDIR+=	gssapi
75INCS+=		gssapi.h
76.endif
77
78.if ${MK_HESIOD} != "no"
79INCS+=	hesiod.h
80.endif
81
82# XXX unconditionally needed by <netsmb/netbios.h>
83#.if ${MK_IPX} != "no"
84_netipx=	netipx
85#.endif
86
87# Handle the #define aliases for libiconv
88.if ${MK_ICONV} == "yes"
89INCS+=		iconv.h
90.endif
91
92.if ${MK_USB} != "no"
93LSUBDIRS+=	dev/usb
94.endif
95
96.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
97_dev_powermac_nvram=	dev/powermac_nvram
98.endif
99
100# Define SHARED to indicate whether you want symbolic links to the system
101# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
102# probably only useful for developers and should be avoided if you do not
103# wish to tie your /usr/include and /usr/src together.
104#SHARED=	symlinks
105SHARED?=	copies
106
107INCS+=	osreldate.h
108
109SYSDIR=			${.CURDIR}/../sys
110NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
111PARAM_H=		${SYSDIR}/sys/param.h
112MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
113
114osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
115	env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
116	    sh ${MK_OSRELDATE_SH}
117
118.for i in ${LHDRS}
119INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
120.endfor
121.for i in ${MHDRS}
122INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
123.endfor
124.for i in ${PHDRS}
125INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
126.endfor
127
128.if ${MACHINE} != ${MACHINE_CPUARCH}
129_MARCHS=	${MACHINE_CPUARCH}
130.endif
131.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
132_MARCHS+=	x86
133.endif
134
135.include <bsd.prog.mk>
136
137installincludes: ${SHARED}
138${SHARED}: compat
139
140# Take care of stale directory-level symlinks.
141compat:
142.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
143	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
144		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
145	fi
146.endfor
147	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
148	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
149	    -p ${DESTDIR}${INCLUDEDIR}
150
151copies:
152.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
153	${_MARCHS}
154.if exists(${DESTDIR}${INCLUDEDIR}/$i)
155	cd ${DESTDIR}${INCLUDEDIR}/$i; \
156	for h in *.h; do \
157		if [ -L $$h ]; then rm -f $$h; fi; \
158	done
159.endif
160.endfor
161.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
162	cd ${.CURDIR}/../sys; \
163	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
164	    ${DESTDIR}${INCLUDEDIR}/$i
165.endfor
166	cd ${.CURDIR}/../sys/dev/acpica; \
167	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
168	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
169	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
170	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
171	cd ${.CURDIR}/../sys/dev/agp; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
173	    ${DESTDIR}${INCLUDEDIR}/dev/agp
174	cd ${.CURDIR}/../sys/dev/bktr; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
176	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
177.if ${MK_NAND} != "no"
178	cd ${.CURDIR}/../sys/dev/nand; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
180	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
181	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
182	    ${DESTDIR}${INCLUDEDIR}/dev/nand
183.endif
184	cd ${.CURDIR}/../sys/dev/hyperv/include; \
185	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \
186	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
187	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
188	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \
189	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
190	cd ${.CURDIR}/../sys/dev/pci; \
191	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
192	    ${DESTDIR}${INCLUDEDIR}/dev/pci
193	cd ${.CURDIR}/../sys/contrib/altq/altq; \
194	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195	    ${DESTDIR}${INCLUDEDIR}/altq
196	cd ${.CURDIR}/../sys/fs/cd9660/; \
197	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
199.if ${MK_IPFILTER} != "no"
200	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
201	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202	    ${DESTDIR}${INCLUDEDIR}/netinet
203.endif
204.if ${MK_PF} != "no"
205	cd ${.CURDIR}/../sys/netpfil/pf; \
206	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
208.endif
209	cd ${.CURDIR}/../sys/crypto; \
210	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
211	    ${DESTDIR}${INCLUDEDIR}/crypto
212	cd ${.CURDIR}/../sys/opencrypto; \
213	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
214	    ${DESTDIR}${INCLUDEDIR}/crypto
215	cd ${.CURDIR}/../sys/${MACHINE}/include; \
216	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
217	    ${DESTDIR}${INCLUDEDIR}/machine
218.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
219	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
220	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
221	    ${DESTDIR}${INCLUDEDIR}/machine/pc
222.endif
223.for _MARCH in ${_MARCHS}
224.if exists(${.CURDIR}/../sys/${_MARCH}/include)
225	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
226	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
227	cd ${.CURDIR}/../sys/${_MARCH}/include; \
228	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
229	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
230.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
231	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
232	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
233	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
234	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
235	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
236.endif
237.endif
238.endfor
239	cd ${.CURDIR}/../sys/rpc; \
240	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
241	    ${DESTDIR}${INCLUDEDIR}/rpc
242.if ${MK_CDDL} != "no"
243	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
244	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libzfs_core.h \
245	    ${DESTDIR}${INCLUDEDIR}
246	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
247	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
248	    ${DESTDIR}${INCLUDEDIR}
249	cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
250	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
251	    ${DESTDIR}${INCLUDEDIR}/sys
252.endif
253
254symlinks:
255	@${ECHO} "Setting up symlinks to kernel source tree..."
256.for i in ${LDIRS}
257	cd ${.CURDIR}/../sys/$i; \
258	for h in *.h; do \
259		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
260	done
261.endfor
262.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci}
263	cd ${.CURDIR}/../sys/$i; \
264	for h in *.h; do \
265		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
266	done
267.endfor
268	cd ${.CURDIR}/../sys/dev/acpica; \
269	for h in acpiio.h acpi_hpet.h; do \
270		ln -fs ../../../../sys/dev/acpica/$$h \
271		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
272	done
273	cd ${.CURDIR}/../sys/dev/agp; \
274	for h in agpreg.h; do \
275		ln -fs ../../../../sys/dev/agp/$$h \
276		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
277	done
278	cd ${.CURDIR}/../sys/dev/bktr; \
279	for h in ioctl_*.h; do \
280		ln -fs ../../../../sys/dev/bktr/$$h \
281		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
282	done
283.if ${MK_NAND} != "no"
284	cd ${.CURDIR}/../sys/dev/nand; \
285	for h in nandsim.h nand_dev.h; do \
286		ln -fs ../../../../sys/dev/nand/$$h \
287		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
288	done
289.endif
290	cd ${.CURDIR}/../sys/dev/hyperv/include; \
291	for h in hyperv.h; do \
292		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \
293		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
294	done
295	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
296	for h in hv_snapshot.h; do \
297		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \
298		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
299	done
300	cd ${.CURDIR}/../sys/dev/pci; \
301	for h in pcireg.h; do \
302		ln -fs ../../../../sys/dev/pci/$$h \
303		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
304	done
305.for i in ${LSUBSUBDIRS}
306	cd ${.CURDIR}/../sys/$i; \
307	for h in *.h; do \
308		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
309	done
310.endfor
311	cd ${.CURDIR}/../sys/contrib/altq/altq; \
312	for h in *.h; do \
313		ln -fs ../../../sys/contrib/altq/altq/$$h \
314		    ${DESTDIR}${INCLUDEDIR}/altq; \
315	done
316.if ${MK_IPFILTER} != "no"
317	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
318	for h in *.h; do \
319		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
320		    ${DESTDIR}${INCLUDEDIR}/netinet; \
321	done
322.endif
323.if ${MK_PF} != "no"
324	cd ${.CURDIR}/../sys/netpfil/pf; \
325	for h in *.h; do \
326		ln -fs ../../../../sys/netpfil/pf/$$h \
327		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
328	done
329.endif
330	cd ${.CURDIR}/../sys/crypto; \
331	for h in rijndael/rijndael.h; do \
332		ln -fs ../../../sys/crypto/$$h \
333		    ${DESTDIR}${INCLUDEDIR}/crypto; \
334	done
335	cd ${.CURDIR}/../sys/opencrypto; \
336	for h in *.h; do \
337		ln -fs ../../../sys/opencrypto/$$h \
338		    ${DESTDIR}${INCLUDEDIR}/crypto; \
339	done
340	cd ${.CURDIR}/../sys/${MACHINE}/include; \
341	for h in *.h; do \
342		ln -fs ../../../sys/${MACHINE}/include/$$h \
343		    ${DESTDIR}${INCLUDEDIR}/machine; \
344	done
345.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
346	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
347	for h in *.h; do \
348		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
349		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
350	done
351.endif
352.for _MARCH in ${_MARCHS}
353.if exists(${.CURDIR}/../sys/${_MARCH}/include)
354	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
355	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
356	cd ${.CURDIR}/../sys/${_MARCH}/include; \
357	for h in *.h; do \
358		ln -fs ../../../sys/${_MARCH}/include/$$h \
359		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
360	done
361.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
362	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
363	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
364	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
365	for h in *.h; do \
366		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
367		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
368	done
369.endif
370.endif
371.endfor
372	cd ${.CURDIR}/../sys/fs/cd9660; \
373	for h in *.h; do \
374		ln -fs ../../../../sys/fs/cd9660/$$h \
375		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
376	done
377	cd ${.CURDIR}/../sys/rpc; \
378	for h in types.h; do \
379		ln -fs ../../../sys/rpc/$$h \
380		    ${DESTDIR}${INCLUDEDIR}/rpc; \
381	done
382