xref: /freebsd/include/Makefile (revision 5dae51da3da0cc94d17bd67b308fad304ebec7e0)
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
8PACKAGE=runtime
9TAGS+=	development
10CLEANFILES= osreldate.h version
11SUBDIR= arpa protocols rpcsvc rpc xlocale
12SUBDIR_PARALLEL=
13INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
14	db.h \
15	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
16	fts.h ftw.h getopt.h glob.h grp.h \
17	ieeefp.h ifaddrs.h \
18	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
19	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
20	ndbm.h netconfig.h \
21	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
22	printf.h proc_service.h pthread.h \
23	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
24	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
25	signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
26	stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
27	strings.h sysexits.h tar.h termios.h tgmath.h \
28	time.h timeconv.h timers.h ttyent.h \
29	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
30	wchar.h wctype.h wordexp.h xlocale.h
31
32.PATH: ${.CURDIR}/../contrib/libc-vis
33INCS+=	vis.h
34
35MHDRS=	float.h floatingpoint.h stdarg.h
36
37PHDRS=	sched.h _semaphore.h
38
39LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
40	syslog.h ucontext.h
41
42LDIRS=	bsm cam geom net net80211 netgraph netinet netinet6 \
43	netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
44
45LSUBDIRS=	cam/ata cam/nvme cam/scsi \
46	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
47	dev/hwpmc \
48	dev/ic dev/iicbus 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	net/altq \
57	netgraph/atm netgraph/netflow \
58	netinet/cc \
59	security/audit \
60	security/mac_biba security/mac_bsdextended security/mac_lomac \
61	security/mac_mls security/mac_partition \
62	sys/disk \
63	ufs/ffs ufs/ufs
64
65LSUBSUBDIRS=	dev/mpt/mpilib
66
67.if ${MK_BLUETOOTH} != "no"
68LSUBSUBDIRS+=	netgraph/bluetooth/include
69.endif
70
71.if ${MK_CUSE} != "no"
72LSUBDIRS+=	fs/cuse
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# Handle the #define aliases for libiconv
85.if ${MK_ICONV} == "yes"
86INCS+=		iconv.h
87.endif
88
89.if ${MK_USB} != "no"
90LSUBDIRS+=	dev/usb
91.endif
92
93.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
94_dev_powermac_nvram=	dev/powermac_nvram
95.endif
96
97# Define SHARED to indicate whether you want symbolic links to the system
98# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
99# probably only useful for developers and should be avoided if you do not
100# wish to tie your /usr/include and /usr/src together.
101#SHARED=	symlinks
102SHARED?=	copies
103
104INCS+=	osreldate.h
105
106SYSDIR=			${.CURDIR}/../sys
107NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
108PARAM_H=		${SYSDIR}/sys/param.h
109MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
110
111SYMLINKS+= ${INCLUDEDIR} ${LIBDIR}/include
112
113osreldate.h: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
114	env NEWVERS_SH=${NEWVERS_SH} PARAMFILE=${PARAM_H} SYSDIR=${SYSDIR} \
115	    sh ${MK_OSRELDATE_SH}
116
117.for i in ${LHDRS}
118INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
119.endfor
120.for i in ${MHDRS}
121INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
122.endfor
123.for i in ${PHDRS}
124INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
125.endfor
126
127.if ${MACHINE} != ${MACHINE_CPUARCH}
128_MARCHS=	${MACHINE_CPUARCH}
129.endif
130.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
131_MARCHS+=	x86
132.endif
133
134META_TARGETS+=	compat
135stage_includes: ${SHARED}
136
137# Take care of stale directory-level symlinks.
138compat:
139.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
140	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
141		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
142	fi
143.endfor
144	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
145	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
146	    -p ${DESTDIR}${INCLUDEDIR} > /dev/null
147
148copies: .PHONY .META
149.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \
150	${_MARCHS}
151	if [ -d ${DESTDIR}${INCLUDEDIR}/$i ]; then \
152		cd ${DESTDIR}${INCLUDEDIR}/$i; \
153		for h in *.h; do \
154			if [ -L $$h ]; then rm -f $$h; fi; \
155		done; \
156	fi
157.endfor
158.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
159	cd ${.CURDIR}/../sys; \
160	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
161	    ${DESTDIR}${INCLUDEDIR}/$i
162.endfor
163	cd ${.CURDIR}/../sys/dev/acpica; \
164	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
165	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
166	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
167	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
168	cd ${.CURDIR}/../sys/dev/agp; \
169	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
170	    ${DESTDIR}${INCLUDEDIR}/dev/agp
171	cd ${.CURDIR}/../sys/dev/bktr; \
172	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
173	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
174.if ${MK_NAND} != "no"
175	cd ${.CURDIR}/../sys/dev/nand; \
176	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
177	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
178	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
179	    ${DESTDIR}${INCLUDEDIR}/dev/nand
180.endif
181	cd ${.CURDIR}/../sys/dev/evdev; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input.h \
183	    ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
184	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 input-event-codes.h \
185	    ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
186	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 uinput.h \
187	    ${DESTDIR}${INCLUDEDIR}/dev/evdev
188	cd ${.CURDIR}/../sys/dev/pci; \
189	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
190	    ${DESTDIR}${INCLUDEDIR}/dev/pci
191	cd ${.CURDIR}/../sys/fs/cd9660/; \
192	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
194.if ${MK_IPFILTER} != "no"
195	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
196	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197	    ${DESTDIR}${INCLUDEDIR}/netinet
198.endif
199.if ${MK_PF} != "no"
200	cd ${.CURDIR}/../sys/netpfil/pf; \
201	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
203.endif
204	cd ${.CURDIR}/../sys/crypto; \
205	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
206	    ${DESTDIR}${INCLUDEDIR}/crypto
207	cd ${.CURDIR}/../sys/opencrypto; \
208	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
209	    ${DESTDIR}${INCLUDEDIR}/crypto
210	cd ${.CURDIR}/../sys/${MACHINE}/include; \
211	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
212	    ${DESTDIR}${INCLUDEDIR}/machine
213.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
214	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
215	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
216	    ${DESTDIR}${INCLUDEDIR}/machine/pc
217.endif
218.for _MARCH in ${_MARCHS}
219.if exists(${.CURDIR}/../sys/${_MARCH}/include)
220	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
221	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
222	cd ${.CURDIR}/../sys/${_MARCH}/include; \
223	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
224	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
225.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
226	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
227	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
228	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
229	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
230	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
231.endif
232.endif
233.endfor
234	cd ${.CURDIR}/../sys/rpc; \
235	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
236	    ${DESTDIR}${INCLUDEDIR}/rpc
237	cd ${.CURDIR}/../sys/teken; \
238	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
239	    ${DESTDIR}${INCLUDEDIR}/teken
240.if ${MK_CDDL} != "no"
241	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libzfs_core/common; \
242	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libzfs_core.h \
243	    ${DESTDIR}${INCLUDEDIR}
244	cd ${.CURDIR}/../cddl/contrib/opensolaris/lib/libnvpair; \
245	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 libnvpair.h \
246	    ${DESTDIR}${INCLUDEDIR}
247	cd ${.CURDIR}/../sys/cddl/contrib/opensolaris/uts/common/sys; \
248	${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 nvpair.h \
249	    ${DESTDIR}${INCLUDEDIR}/sys
250.endif
251
252symlinks: .PHONY .META
253	@${ECHO} "Setting up symlinks to kernel source tree..."
254.for i in ${LDIRS}
255	cd ${.CURDIR}/../sys/$i; \
256	for h in *.h; do \
257		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
258	done
259.endfor
260.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/evdev:Ndev/nand:Ndev/pci}
261	cd ${.CURDIR}/../sys/$i; \
262	for h in *.h; do \
263		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
264	done
265.endfor
266	cd ${.CURDIR}/../sys/dev/acpica; \
267	for h in acpiio.h acpi_hpet.h; do \
268		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/acpica/$$h \
269		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
270	done
271	cd ${.CURDIR}/../sys/dev/agp; \
272	for h in agpreg.h; do \
273		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/agp/$$h \
274		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
275	done
276	cd ${.CURDIR}/../sys/dev/bktr; \
277	for h in ioctl_*.h; do \
278		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/bktr/$$h \
279		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
280	done
281.if ${MK_NAND} != "no"
282	cd ${.CURDIR}/../sys/dev/nand; \
283	for h in nandsim.h nand_dev.h; do \
284		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/nand/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
286	done
287.endif
288	cd ${.CURDIR}/../sys/dev/evdev; \
289	for h in input.h input-event-codes.h uinput.h; do \
290		ln -fs ../../../../sys/dev/evdev/$$h \
291		    ${DESTDIR}${INCLUDEDIR}/dev/evdev; \
292	done
293	cd ${.CURDIR}/../sys/dev/pci; \
294	for h in pcireg.h; do \
295		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/dev/pci/$$h \
296		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
297	done
298.for i in ${LSUBSUBDIRS}
299	cd ${.CURDIR}/../sys/$i; \
300	for h in *.h; do \
301		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
302	done
303.endfor
304.if ${MK_IPFILTER} != "no"
305	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
306	for h in *.h; do \
307		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/contrib/ipfilter/netinet/$$h \
308		    ${DESTDIR}${INCLUDEDIR}/netinet; \
309	done
310.endif
311.if ${MK_PF} != "no"
312	cd ${.CURDIR}/../sys/netpfil/pf; \
313	for h in *.h; do \
314		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/netpfil/pf/$$h \
315		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
316	done
317.endif
318	cd ${.CURDIR}/../sys/crypto; \
319	for h in rijndael/rijndael.h; do \
320		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/crypto/$$h \
321		    ${DESTDIR}${INCLUDEDIR}/crypto; \
322	done
323	cd ${.CURDIR}/../sys/opencrypto; \
324	for h in *.h; do \
325		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/opencrypto/$$h \
326		    ${DESTDIR}${INCLUDEDIR}/crypto; \
327	done
328	cd ${.CURDIR}/../sys/${MACHINE}/include; \
329	for h in *.h; do \
330		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${MACHINE}/include/$$h \
331		    ${DESTDIR}${INCLUDEDIR}/machine; \
332	done
333.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
334	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
335	for h in *.h; do \
336		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${MACHINE}/include/pc/$$h \
337		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
338	done
339.endif
340.for _MARCH in ${_MARCHS}
341.if exists(${.CURDIR}/../sys/${_MARCH}/include)
342	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
343	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
344	cd ${.CURDIR}/../sys/${_MARCH}/include; \
345	for h in *.h; do \
346		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/${_MARCH}/include/$$h \
347		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
348	done
349.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
350	${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \
351	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
352	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
353	for h in *.h; do \
354		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/${_MARCH}/include/pc/$$h \
355		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
356	done
357.endif
358.endif
359.endfor
360	cd ${.CURDIR}/../sys/fs/cd9660; \
361	for h in *.h; do \
362		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../../sys/fs/cd9660/$$h \
363		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
364	done
365	cd ${.CURDIR}/../sys/rpc; \
366	for h in types.h; do \
367		${INSTALL_SYMLINK} ${TAG_ARGS} ../../../sys/rpc/$$h \
368		    ${DESTDIR}${INCLUDEDIR}/rpc; \
369	done
370
371.include <bsd.prog.mk>
372
373installincludes: ${SHARED}
374${SHARED}: compat
375
376.if ${MACHINE} == "host" && !defined(_SKIP_BUILD)
377# we're here because we are building a sysroot...
378# we need MACHINE et al set correctly
379HOST_MACHINE!= uname -m
380HOST_MACHINE_ARCH!= uname -p
381MACHINE:= ${HOST_MACHINE}
382MACHINE_ARCH:= ${HOST_MACHINE_ARCH}
383.endif
384