Makefile revision 316781
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: stable/10/include/Makefile 316781 2017-04-13 19:48:45Z ian $
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/nvme \
49	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
50	dev/speaker dev/utopia dev/vkbd dev/wi \
51	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
52	fs/procfs fs/smbfs fs/udf fs/unionfs \
53	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
54	geom/mirror geom/mountver geom/multipath geom/nop \
55	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
56	netgraph/atm netgraph/netflow \
57	security/audit \
58	security/mac_biba security/mac_bsdextended security/mac_lomac \
59	security/mac_mls security/mac_partition \
60	ufs/ffs ufs/ufs
61
62LSUBSUBDIRS=	dev/mpt/mpilib
63
64.if ${MK_BLUETOOTH} != "no"
65LSUBSUBDIRS+=	netgraph/bluetooth/include
66.endif
67
68.if ${MK_GPIB} != "no"
69_dev_ieee488=	dev/ieee488
70.endif
71
72.if ${MK_GSSAPI} != "no"
73SUBDIR+=	gssapi
74INCS+=		gssapi.h
75.endif
76
77.if ${MK_HESIOD} != "no"
78INCS+=	hesiod.h
79.endif
80
81# XXX unconditionally needed by <netsmb/netbios.h>
82#.if ${MK_IPX} != "no"
83_netipx=	netipx
84#.endif
85
86# Handle the #define aliases for libiconv
87.if ${MK_ICONV} == "yes"
88INCS+=		iconv.h
89.endif
90
91.if ${MK_USB} != "no"
92LSUBDIRS+=	dev/usb
93.endif
94
95.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
96_dev_powermac_nvram=	dev/powermac_nvram
97.endif
98
99# Define SHARED to indicate whether you want symbolic links to the system
100# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
101# probably only useful for developers and should be avoided if you do not
102# wish to tie your /usr/include and /usr/src together.
103#SHARED=	symlinks
104SHARED?=	copies
105
106INCS+=	osreldate.h
107
108SYSDIR=			${.CURDIR}/../sys
109NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
110PARAM_H=		${SYSDIR}/sys/param.h
111MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
112
113osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
114	env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
115	    sh ${MK_OSRELDATE_SH}
116
117.for i in ${LHDRS}
118INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
119.endfor
120.for i in ${MHDRS}
121INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
122.endfor
123.for i in ${PHDRS}
124INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
125.endfor
126
127.if ${MACHINE} != ${MACHINE_CPUARCH}
128_MARCHS=	${MACHINE_CPUARCH}
129.endif
130.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
131_MARCHS+=	x86
132.endif
133
134.include <bsd.prog.mk>
135
136installincludes: ${SHARED}
137${SHARED}: compat
138
139# Take care of stale directory-level symlinks.
140compat:
141.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
142	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
143		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
144	fi
145.endfor
146	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
147	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
148	    -p ${DESTDIR}${INCLUDEDIR}
149
150copies:
151.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
152	${_MARCHS}
153.if exists(${DESTDIR}${INCLUDEDIR}/$i)
154	cd ${DESTDIR}${INCLUDEDIR}/$i; \
155	for h in *.h; do \
156		if [ -L $$h ]; then rm -f $$h; fi; \
157	done
158.endif
159.endfor
160.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
161	cd ${.CURDIR}/../sys; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
163	    ${DESTDIR}${INCLUDEDIR}/$i
164.endfor
165	cd ${.CURDIR}/../sys/dev/acpica; \
166	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
167	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
169	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
170	cd ${.CURDIR}/../sys/dev/agp; \
171	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
172	    ${DESTDIR}${INCLUDEDIR}/dev/agp
173	cd ${.CURDIR}/../sys/dev/bktr; \
174	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
175	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
176.if ${MK_NAND} != "no"
177	cd ${.CURDIR}/../sys/dev/nand; \
178	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
179	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
180	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
181	    ${DESTDIR}${INCLUDEDIR}/dev/nand
182.endif
183	cd ${.CURDIR}/../sys/dev/hyperv/include; \
184	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \
185	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
186	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
187	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \
188	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
189	cd ${.CURDIR}/../sys/dev/pci; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
191	    ${DESTDIR}${INCLUDEDIR}/dev/pci
192	cd ${.CURDIR}/../sys/contrib/altq/altq; \
193	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
194	    ${DESTDIR}${INCLUDEDIR}/altq
195	cd ${.CURDIR}/../sys/fs/cd9660/; \
196	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
198.if ${MK_IPFILTER} != "no"
199	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
200	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201	    ${DESTDIR}${INCLUDEDIR}/netinet
202.endif
203.if ${MK_PF} != "no"
204	cd ${.CURDIR}/../sys/netpfil/pf; \
205	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
206	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
207.endif
208	cd ${.CURDIR}/../sys/crypto; \
209	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
210	    ${DESTDIR}${INCLUDEDIR}/crypto
211	cd ${.CURDIR}/../sys/opencrypto; \
212	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
213	    ${DESTDIR}${INCLUDEDIR}/crypto
214	cd ${.CURDIR}/../sys/${MACHINE}/include; \
215	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
216	    ${DESTDIR}${INCLUDEDIR}/machine
217.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
218	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
219	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
220	    ${DESTDIR}${INCLUDEDIR}/machine/pc
221.endif
222.for _MARCH in ${_MARCHS}
223.if exists(${.CURDIR}/../sys/${_MARCH}/include)
224	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
225	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
226	cd ${.CURDIR}/../sys/${_MARCH}/include; \
227	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
228	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
229.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
230	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
231	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
232	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
233	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
234	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
235.endif
236.endif
237.endfor
238	cd ${.CURDIR}/../sys/rpc; \
239	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
240	    ${DESTDIR}${INCLUDEDIR}/rpc
241.if ${MK_CDDL} != "no"
242	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
243	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libzfs_core.h \
244	    ${DESTDIR}${INCLUDEDIR}
245	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
246	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
247	    ${DESTDIR}${INCLUDEDIR}
248	cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
249	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
250	    ${DESTDIR}${INCLUDEDIR}/sys
251.endif
252
253symlinks:
254	@${ECHO} "Setting up symlinks to kernel source tree..."
255.for i in ${LDIRS}
256	cd ${.CURDIR}/../sys/$i; \
257	for h in *.h; do \
258		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
259	done
260.endfor
261.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci}
262	cd ${.CURDIR}/../sys/$i; \
263	for h in *.h; do \
264		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
265	done
266.endfor
267	cd ${.CURDIR}/../sys/dev/acpica; \
268	for h in acpiio.h acpi_hpet.h; do \
269		ln -fs ../../../../sys/dev/acpica/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
271	done
272	cd ${.CURDIR}/../sys/dev/agp; \
273	for h in agpreg.h; do \
274		ln -fs ../../../../sys/dev/agp/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
276	done
277	cd ${.CURDIR}/../sys/dev/bktr; \
278	for h in ioctl_*.h; do \
279		ln -fs ../../../../sys/dev/bktr/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
281	done
282.if ${MK_NAND} != "no"
283	cd ${.CURDIR}/../sys/dev/nand; \
284	for h in nandsim.h nand_dev.h; do \
285		ln -fs ../../../../sys/dev/nand/$$h \
286		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
287	done
288.endif
289	cd ${.CURDIR}/../sys/dev/hyperv/include; \
290	for h in hyperv.h; do \
291		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \
292		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
293	done
294	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
295	for h in hv_snapshot.h; do \
296		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \
297		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
298	done
299	cd ${.CURDIR}/../sys/dev/pci; \
300	for h in pcireg.h; do \
301		ln -fs ../../../../sys/dev/pci/$$h \
302		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
303	done
304.for i in ${LSUBSUBDIRS}
305	cd ${.CURDIR}/../sys/$i; \
306	for h in *.h; do \
307		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
308	done
309.endfor
310	cd ${.CURDIR}/../sys/contrib/altq/altq; \
311	for h in *.h; do \
312		ln -fs ../../../sys/contrib/altq/altq/$$h \
313		    ${DESTDIR}${INCLUDEDIR}/altq; \
314	done
315.if ${MK_IPFILTER} != "no"
316	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
317	for h in *.h; do \
318		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
319		    ${DESTDIR}${INCLUDEDIR}/netinet; \
320	done
321.endif
322.if ${MK_PF} != "no"
323	cd ${.CURDIR}/../sys/netpfil/pf; \
324	for h in *.h; do \
325		ln -fs ../../../../sys/netpfil/pf/$$h \
326		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
327	done
328.endif
329	cd ${.CURDIR}/../sys/crypto; \
330	for h in rijndael/rijndael.h; do \
331		ln -fs ../../../sys/crypto/$$h \
332		    ${DESTDIR}${INCLUDEDIR}/crypto; \
333	done
334	cd ${.CURDIR}/../sys/opencrypto; \
335	for h in *.h; do \
336		ln -fs ../../../sys/opencrypto/$$h \
337		    ${DESTDIR}${INCLUDEDIR}/crypto; \
338	done
339	cd ${.CURDIR}/../sys/${MACHINE}/include; \
340	for h in *.h; do \
341		ln -fs ../../../sys/${MACHINE}/include/$$h \
342		    ${DESTDIR}${INCLUDEDIR}/machine; \
343	done
344.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
345	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
346	for h in *.h; do \
347		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
348		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
349	done
350.endif
351.for _MARCH in ${_MARCHS}
352.if exists(${.CURDIR}/../sys/${_MARCH}/include)
353	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
354	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
355	cd ${.CURDIR}/../sys/${_MARCH}/include; \
356	for h in *.h; do \
357		ln -fs ../../../sys/${_MARCH}/include/$$h \
358		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
359	done
360.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
361	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
362	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
363	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
364	for h in *.h; do \
365		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
366		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
367	done
368.endif
369.endif
370.endfor
371	cd ${.CURDIR}/../sys/fs/cd9660; \
372	for h in *.h; do \
373		ln -fs ../../../../sys/fs/cd9660/$$h \
374		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
375	done
376	cd ${.CURDIR}/../sys/rpc; \
377	for h in types.h; do \
378		ln -fs ../../../sys/rpc/$$h \
379		    ${DESTDIR}${INCLUDEDIR}/rpc; \
380	done
381