Makefile revision 311223
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: stable/10/include/Makefile 311223 2017-01-04 01:58:38Z sephe $
3#
4# Doing a "make install" builds /usr/include.
5
6.include <bsd.own.mk>
7
8CLEANFILES= osreldate.h version vers.c
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 vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
114	env ECHO="${ECHO}" \
115	    MAKE="${MAKE}" \
116	    NEWVERS_SH=${NEWVERS_SH} \
117	    PARAM_H=${PARAM_H} \
118	    SYSDIR=${SYSDIR} \
119	    sh ${MK_OSRELDATE_SH}
120
121.for i in ${LHDRS}
122INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
123.endfor
124.for i in ${MHDRS}
125INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
126.endfor
127.for i in ${PHDRS}
128INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
129.endfor
130
131.if ${MACHINE} != ${MACHINE_CPUARCH}
132_MARCHS=	${MACHINE_CPUARCH}
133.endif
134.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
135_MARCHS+=	x86
136.endif
137
138.include <bsd.prog.mk>
139
140installincludes: ${SHARED}
141${SHARED}: compat
142
143# Take care of stale directory-level symlinks.
144compat:
145.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
146	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
147		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
148	fi
149.endfor
150	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
151	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
152	    -p ${DESTDIR}${INCLUDEDIR}
153
154copies:
155.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
156	${_MARCHS}
157.if exists(${DESTDIR}${INCLUDEDIR}/$i)
158	cd ${DESTDIR}${INCLUDEDIR}/$i; \
159	for h in *.h; do \
160		if [ -L $$h ]; then rm -f $$h; fi; \
161	done
162.endif
163.endfor
164.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
165	cd ${.CURDIR}/../sys; \
166	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
167	    ${DESTDIR}${INCLUDEDIR}/$i
168.endfor
169	cd ${.CURDIR}/../sys/dev/acpica; \
170	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
171	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
173	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
174	cd ${.CURDIR}/../sys/dev/agp; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
176	    ${DESTDIR}${INCLUDEDIR}/dev/agp
177	cd ${.CURDIR}/../sys/dev/bktr; \
178	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
179	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
180.if ${MK_NAND} != "no"
181	cd ${.CURDIR}/../sys/dev/nand; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
183	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
184	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
185	    ${DESTDIR}${INCLUDEDIR}/dev/nand
186.endif
187	cd ${.CURDIR}/../sys/dev/hyperv/include; \
188	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hyperv.h \
189	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
190	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
191	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 hv_snapshot.h \
192	    ${DESTDIR}${INCLUDEDIR}/dev/hyperv
193	cd ${.CURDIR}/../sys/dev/pci; \
194	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
195	    ${DESTDIR}${INCLUDEDIR}/dev/pci
196	cd ${.CURDIR}/../sys/contrib/altq/altq; \
197	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
198	    ${DESTDIR}${INCLUDEDIR}/altq
199	cd ${.CURDIR}/../sys/fs/cd9660/; \
200	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
202.if ${MK_IPFILTER} != "no"
203	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
204	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
205	    ${DESTDIR}${INCLUDEDIR}/netinet
206.endif
207.if ${MK_PF} != "no"
208	cd ${.CURDIR}/../sys/netpfil/pf; \
209	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
211.endif
212	cd ${.CURDIR}/../sys/crypto; \
213	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
214	    ${DESTDIR}${INCLUDEDIR}/crypto
215	cd ${.CURDIR}/../sys/opencrypto; \
216	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
217	    ${DESTDIR}${INCLUDEDIR}/crypto
218	cd ${.CURDIR}/../sys/${MACHINE}/include; \
219	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
220	    ${DESTDIR}${INCLUDEDIR}/machine
221.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
222	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
223	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
224	    ${DESTDIR}${INCLUDEDIR}/machine/pc
225.endif
226.for _MARCH in ${_MARCHS}
227.if exists(${.CURDIR}/../sys/${_MARCH}/include)
228	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
229	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
230	cd ${.CURDIR}/../sys/${_MARCH}/include; \
231	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
232	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
233.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
234	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
235	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
236	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
237	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
238	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
239.endif
240.endif
241.endfor
242	cd ${.CURDIR}/../sys/rpc; \
243	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
244	    ${DESTDIR}${INCLUDEDIR}/rpc
245.if ${MK_CDDL} != "no"
246	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
247	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libzfs_core.h \
248	    ${DESTDIR}${INCLUDEDIR}
249	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
250	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
251	    ${DESTDIR}${INCLUDEDIR}
252	cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
253	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
254	    ${DESTDIR}${INCLUDEDIR}/sys
255.endif
256
257symlinks:
258	@${ECHO} "Setting up symlinks to kernel source tree..."
259.for i in ${LDIRS}
260	cd ${.CURDIR}/../sys/$i; \
261	for h in *.h; do \
262		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
263	done
264.endfor
265.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/hyperv:Ndev/nand:Ndev/pci}
266	cd ${.CURDIR}/../sys/$i; \
267	for h in *.h; do \
268		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
269	done
270.endfor
271	cd ${.CURDIR}/../sys/dev/acpica; \
272	for h in acpiio.h acpi_hpet.h; do \
273		ln -fs ../../../../sys/dev/acpica/$$h \
274		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
275	done
276	cd ${.CURDIR}/../sys/dev/agp; \
277	for h in agpreg.h; do \
278		ln -fs ../../../../sys/dev/agp/$$h \
279		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
280	done
281	cd ${.CURDIR}/../sys/dev/bktr; \
282	for h in ioctl_*.h; do \
283		ln -fs ../../../../sys/dev/bktr/$$h \
284		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
285	done
286.if ${MK_NAND} != "no"
287	cd ${.CURDIR}/../sys/dev/nand; \
288	for h in nandsim.h nand_dev.h; do \
289		ln -fs ../../../../sys/dev/nand/$$h \
290		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
291	done
292.endif
293	cd ${.CURDIR}/../sys/dev/hyperv/include; \
294	for h in hyperv.h; do \
295		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/include/$$h \
296		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
297	done
298	cd ${.CURDIR}/../sys/dev/hyperv/utilities; \
299	for h in hv_snapshot.h; do \
300		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/hyperv/utilities/$$h \
301		    ${DESTDIR}${INCLUDEDIR}/dev/hyperv; \
302	done
303	cd ${.CURDIR}/../sys/dev/pci; \
304	for h in pcireg.h; do \
305		ln -fs ../../../../sys/dev/pci/$$h \
306		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
307	done
308.for i in ${LSUBSUBDIRS}
309	cd ${.CURDIR}/../sys/$i; \
310	for h in *.h; do \
311		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
312	done
313.endfor
314	cd ${.CURDIR}/../sys/contrib/altq/altq; \
315	for h in *.h; do \
316		ln -fs ../../../sys/contrib/altq/altq/$$h \
317		    ${DESTDIR}${INCLUDEDIR}/altq; \
318	done
319.if ${MK_IPFILTER} != "no"
320	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
321	for h in *.h; do \
322		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
323		    ${DESTDIR}${INCLUDEDIR}/netinet; \
324	done
325.endif
326.if ${MK_PF} != "no"
327	cd ${.CURDIR}/../sys/netpfil/pf; \
328	for h in *.h; do \
329		ln -fs ../../../../sys/netpfil/pf/$$h \
330		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
331	done
332.endif
333	cd ${.CURDIR}/../sys/crypto; \
334	for h in rijndael/rijndael.h; do \
335		ln -fs ../../../sys/crypto/$$h \
336		    ${DESTDIR}${INCLUDEDIR}/crypto; \
337	done
338	cd ${.CURDIR}/../sys/opencrypto; \
339	for h in *.h; do \
340		ln -fs ../../../sys/opencrypto/$$h \
341		    ${DESTDIR}${INCLUDEDIR}/crypto; \
342	done
343	cd ${.CURDIR}/../sys/${MACHINE}/include; \
344	for h in *.h; do \
345		ln -fs ../../../sys/${MACHINE}/include/$$h \
346		    ${DESTDIR}${INCLUDEDIR}/machine; \
347	done
348.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
349	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
350	for h in *.h; do \
351		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
352		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
353	done
354.endif
355.for _MARCH in ${_MARCHS}
356.if exists(${.CURDIR}/../sys/${_MARCH}/include)
357	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
358	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
359	cd ${.CURDIR}/../sys/${_MARCH}/include; \
360	for h in *.h; do \
361		ln -fs ../../../sys/${_MARCH}/include/$$h \
362		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
363	done
364.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
365	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
366	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
367	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
368	for h in *.h; do \
369		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
370		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
371	done
372.endif
373.endif
374.endfor
375	cd ${.CURDIR}/../sys/fs/cd9660; \
376	for h in *.h; do \
377		ln -fs ../../../../sys/fs/cd9660/$$h \
378		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
379	done
380	cd ${.CURDIR}/../sys/rpc; \
381	for h in types.h; do \
382		ln -fs ../../../sys/rpc/$$h \
383		    ${DESTDIR}${INCLUDEDIR}/rpc; \
384	done
385