Makefile revision 280419
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: stable/10/include/Makefile 280419 2015-03-24 06:55:08Z ngie $
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
10INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11	db.h \
12	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13	fts.h ftw.h getopt.h glob.h grp.h \
14	ieeefp.h ifaddrs.h \
15	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17	ndbm.h netconfig.h \
18	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
19	printf.h proc_service.h pthread.h \
20	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
21	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
22	signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
23	stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h termios.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
27	wchar.h wctype.h wordexp.h xlocale.h
28
29.PATH: ${.CURDIR}/../contrib/libc-vis
30INCS+=	vis.h
31
32MHDRS=	float.h floatingpoint.h stdarg.h
33
34PHDRS=	sched.h _semaphore.h
35
36LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
37	syslog.h ucontext.h
38
39LDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
40	netipsec ${_netipx} netnatm netsmb \
41	nfs nfsclient nfsserver \
42	sys vm
43
44LSUBDIRS=	cam/ata cam/scsi \
45	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
46	dev/hwpmc \
47	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
48	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
49	dev/speaker dev/utopia dev/vkbd dev/wi \
50	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
51	fs/procfs fs/smbfs fs/udf fs/unionfs \
52	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
53	geom/mirror geom/mountver geom/multipath geom/nop \
54	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
55	netgraph/atm netgraph/netflow \
56	security/audit \
57	security/mac_biba security/mac_bsdextended security/mac_lomac \
58	security/mac_mls security/mac_partition \
59	ufs/ffs ufs/ufs
60
61.if ${MK_USB} != "no"
62LSUBDIRS+=	dev/usb
63.endif
64
65LSUBSUBDIRS=	dev/mpt/mpilib
66
67.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
68_dev_powermac_nvram=	dev/powermac_nvram
69.endif
70
71.if ${MK_GPIB} != "no"
72_dev_ieee488=	dev/ieee488
73.endif
74
75.if ${MK_GSSAPI} != "no"
76SUBDIR+=	gssapi
77INCS+=		gssapi.h
78.endif
79
80.if ${MK_HESIOD} != "no"
81INCS+=	hesiod.h
82.endif
83
84.if ${MK_BLUETOOTH} != "no"
85LSUBSUBDIRS+=	netgraph/bluetooth/include
86.endif
87
88# XXX unconditionally needed by <netsmb/netbios.h>
89#.if ${MK_IPX} != "no"
90_netipx=	netipx
91#.endif
92
93# Handle the #define aliases for libiconv
94.if ${MK_ICONV} == "yes"
95INCS+=		iconv.h
96.endif
97	
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/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/pci; \
188	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
189	    ${DESTDIR}${INCLUDEDIR}/dev/pci
190	cd ${.CURDIR}/../sys/contrib/altq/altq; \
191	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
192	    ${DESTDIR}${INCLUDEDIR}/altq
193	cd ${.CURDIR}/../sys/fs/cd9660/; \
194	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
196.if ${MK_IPFILTER} != "no"
197	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
198	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
199	    ${DESTDIR}${INCLUDEDIR}/netinet
200.endif
201.if ${MK_PF} != "no"
202	cd ${.CURDIR}/../sys/netpfil/pf; \
203	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
204	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
205.endif
206	cd ${.CURDIR}/../sys/crypto; \
207	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
208	    ${DESTDIR}${INCLUDEDIR}/crypto
209	cd ${.CURDIR}/../sys/opencrypto; \
210	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
211	    ${DESTDIR}${INCLUDEDIR}/crypto
212	cd ${.CURDIR}/../sys/${MACHINE}/include; \
213	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
214	    ${DESTDIR}${INCLUDEDIR}/machine
215.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
216	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
217	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
218	    ${DESTDIR}${INCLUDEDIR}/machine/pc
219.endif
220.for _MARCH in ${_MARCHS}
221.if exists(${.CURDIR}/../sys/${_MARCH}/include)
222	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
223	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
224	cd ${.CURDIR}/../sys/${_MARCH}/include; \
225	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
226	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
227.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
228	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
229	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
230	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
231	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
232	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
233.endif
234.endif
235.endfor
236	cd ${.CURDIR}/../sys/rpc; \
237	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
238	    ${DESTDIR}${INCLUDEDIR}/rpc
239
240symlinks:
241	@${ECHO} "Setting up symlinks to kernel source tree..."
242.for i in ${LDIRS}
243	cd ${.CURDIR}/../sys/$i; \
244	for h in *.h; do \
245		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
246	done
247.endfor
248.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
249	cd ${.CURDIR}/../sys/$i; \
250	for h in *.h; do \
251		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
252	done
253.endfor
254	cd ${.CURDIR}/../sys/dev/acpica; \
255	for h in acpiio.h acpi_hpet.h; do \
256		ln -fs ../../../../sys/dev/acpica/$$h \
257		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
258	done
259	cd ${.CURDIR}/../sys/dev/agp; \
260	for h in agpreg.h; do \
261		ln -fs ../../../../sys/dev/agp/$$h \
262		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
263	done
264	cd ${.CURDIR}/../sys/dev/bktr; \
265	for h in ioctl_*.h; do \
266		ln -fs ../../../../sys/dev/bktr/$$h \
267		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
268	done
269.if ${MK_NAND} != "no"
270	cd ${.CURDIR}/../sys/dev/nand; \
271	for h in nandsim.h nand_dev.h; do \
272		ln -fs ../../../../sys/dev/nand/$$h \
273		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
274	done
275.endif
276	cd ${.CURDIR}/../sys/dev/pci; \
277	for h in pcireg.h; do \
278		ln -fs ../../../../sys/dev/pci/$$h \
279		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
280	done
281.for i in ${LSUBSUBDIRS}
282	cd ${.CURDIR}/../sys/$i; \
283	for h in *.h; do \
284		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
285	done
286.endfor
287	cd ${.CURDIR}/../sys/contrib/altq/altq; \
288	for h in *.h; do \
289		ln -fs ../../../sys/contrib/altq/altq/$$h \
290		    ${DESTDIR}${INCLUDEDIR}/altq; \
291	done
292.if ${MK_IPFILTER} != "no"
293	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
294	for h in *.h; do \
295		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
296		    ${DESTDIR}${INCLUDEDIR}/netinet; \
297	done
298.endif
299.if ${MK_PF} != "no"
300	cd ${.CURDIR}/../sys/netpfil/pf; \
301	for h in *.h; do \
302		ln -fs ../../../../sys/netpfil/pf/$$h \
303		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
304	done
305.endif
306	cd ${.CURDIR}/../sys/crypto; \
307	for h in rijndael/rijndael.h; do \
308		ln -fs ../../../sys/crypto/$$h \
309		    ${DESTDIR}${INCLUDEDIR}/crypto; \
310	done
311	cd ${.CURDIR}/../sys/opencrypto; \
312	for h in *.h; do \
313		ln -fs ../../../sys/opencrypto/$$h \
314		    ${DESTDIR}${INCLUDEDIR}/crypto; \
315	done
316	cd ${.CURDIR}/../sys/${MACHINE}/include; \
317	for h in *.h; do \
318		ln -fs ../../../sys/${MACHINE}/include/$$h \
319		    ${DESTDIR}${INCLUDEDIR}/machine; \
320	done
321.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
322	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
323	for h in *.h; do \
324		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
325		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
326	done
327.endif
328.for _MARCH in ${_MARCHS}
329.if exists(${.CURDIR}/../sys/${_MARCH}/include)
330	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
331	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
332	cd ${.CURDIR}/../sys/${_MARCH}/include; \
333	for h in *.h; do \
334		ln -fs ../../../sys/${_MARCH}/include/$$h \
335		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
336	done
337.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
338	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
339	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
340	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
341	for h in *.h; do \
342		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
343		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
344	done
345.endif
346.endif
347.endfor
348	cd ${.CURDIR}/../sys/fs/cd9660; \
349	for h in *.h; do \
350		ln -fs ../../../../sys/fs/cd9660/$$h \
351		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
352	done
353	cd ${.CURDIR}/../sys/rpc; \
354	for h in types.h; do \
355		ln -fs ../../../sys/rpc/$$h \
356		    ${DESTDIR}${INCLUDEDIR}/rpc; \
357	done
358