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