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