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