xref: /freebsd/include/Makefile (revision 76b28ad6ab6dc8d4a62cb7de7f143595be535813)
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/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.if ${MK_STAGING} != "no"
123# tell bsd.incs.mk that we have it covered
124stage_includes:
125.endif
126
127.include <bsd.prog.mk>
128
129.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
130.if make(all)
131DESTDIR= ${STAGE_OBJTOP}
132
133all:	stage_includes
134installincludes: buildincludes
135buildincludes: stage_prep
136
137stage_prep:
138	@mkdir -p ${DESTDIR}${INCLUDEDIR}
139	@touch $@
140
141stage_includes: .dirdep installincludes
142	@touch $@
143.endif
144.endif
145
146installincludes: ${SHARED}
147${SHARED}: compat
148
149# Take care of stale directory-level symlinks.
150compat:
151.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
152	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
153		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
154	fi
155.endfor
156	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
157	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
158	    -p ${DESTDIR}${INCLUDEDIR} > /dev/null
159.if ${MK_META_MODE} == "yes"
160	touch ${.TARGET}
161.endif
162
163copies:
164.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
165	${_MARCHS}
166.if exists(${DESTDIR}${INCLUDEDIR}/$i)
167	cd ${DESTDIR}${INCLUDEDIR}/$i; \
168	for h in *.h; do \
169		if [ -L $$h ]; then rm -f $$h; fi; \
170	done
171.endif
172.endfor
173.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
174	cd ${.CURDIR}/../sys; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
176	    ${DESTDIR}${INCLUDEDIR}/$i
177.endfor
178	cd ${.CURDIR}/../sys/dev/acpica; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
180	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
181	cd ${.CURDIR}/../sys/dev/agp; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
183	    ${DESTDIR}${INCLUDEDIR}/dev/agp
184	cd ${.CURDIR}/../sys/dev/bktr; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
186	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
187.if ${MK_NAND} != "no"
188	cd ${.CURDIR}/../sys/dev/nand; \
189	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
190	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
191	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
192	    ${DESTDIR}${INCLUDEDIR}/dev/nand
193.endif
194	cd ${.CURDIR}/../sys/dev/pci; \
195	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
196	    ${DESTDIR}${INCLUDEDIR}/dev/pci
197	cd ${.CURDIR}/../sys/contrib/altq/altq; \
198	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
199	    ${DESTDIR}${INCLUDEDIR}/altq
200	cd ${.CURDIR}/../sys/fs/cd9660/; \
201	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
202	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
203.if ${MK_IPFILTER} != "no"
204	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
205	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
206	    ${DESTDIR}${INCLUDEDIR}/netinet
207.endif
208.if ${MK_PF} != "no"
209	cd ${.CURDIR}/../sys/netpfil/pf; \
210	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
211	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
212.endif
213	cd ${.CURDIR}/../sys/crypto; \
214	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
215	    ${DESTDIR}${INCLUDEDIR}/crypto
216	cd ${.CURDIR}/../sys/opencrypto; \
217	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
218	    ${DESTDIR}${INCLUDEDIR}/crypto
219	cd ${.CURDIR}/../sys/${MACHINE}/include; \
220	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
221	    ${DESTDIR}${INCLUDEDIR}/machine
222.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
223	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
224	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
225	    ${DESTDIR}${INCLUDEDIR}/machine/pc
226.endif
227.for _MARCH in ${_MARCHS}
228.if exists(${.CURDIR}/../sys/${_MARCH}/include)
229	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
230	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
231	cd ${.CURDIR}/../sys/${_MARCH}/include; \
232	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
233	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
234.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
235	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
236	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
237	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
238	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
239	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
240.endif
241.endif
242.endfor
243	cd ${.CURDIR}/../sys/rpc; \
244	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
245	    ${DESTDIR}${INCLUDEDIR}/rpc
246	cd ${.CURDIR}/../sys/teken; \
247	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
248	    ${DESTDIR}${INCLUDEDIR}/teken
249.if ${MK_META_MODE} == "yes"
250	touch ${.TARGET}
251.endif
252
253symlinks:
254	@${ECHO} "Setting up symlinks to kernel source tree..."
255.for i in ${LDIRS}
256	cd ${.CURDIR}/../sys/$i; \
257	for h in *.h; do \
258		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
259	done
260.endfor
261.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
262	cd ${.CURDIR}/../sys/$i; \
263	for h in *.h; do \
264		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
265	done
266.endfor
267	cd ${.CURDIR}/../sys/dev/acpica; \
268	for h in acpiio.h; do \
269		ln -fs ../../../../sys/dev/acpica/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
271	done
272	cd ${.CURDIR}/../sys/dev/agp; \
273	for h in agpreg.h; do \
274		ln -fs ../../../../sys/dev/agp/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
276	done
277	cd ${.CURDIR}/../sys/dev/bktr; \
278	for h in ioctl_*.h; do \
279		ln -fs ../../../../sys/dev/bktr/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
281	done
282.if ${MK_NAND} != "no"
283	cd ${.CURDIR}/../sys/dev/nand; \
284	for h in nandsim.h nand_dev.h; do \
285		ln -fs ../../../../sys/dev/nand/$$h \
286		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
287	done
288.endif
289	cd ${.CURDIR}/../sys/dev/pci; \
290	for h in pcireg.h; do \
291		ln -fs ../../../../sys/dev/pci/$$h \
292		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
293	done
294.for i in ${LSUBSUBDIRS}
295	cd ${.CURDIR}/../sys/$i; \
296	for h in *.h; do \
297		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
298	done
299.endfor
300	cd ${.CURDIR}/../sys/contrib/altq/altq; \
301	for h in *.h; do \
302		ln -fs ../../../sys/contrib/altq/altq/$$h \
303		    ${DESTDIR}${INCLUDEDIR}/altq; \
304	done
305.if ${MK_IPFILTER} != "no"
306	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
307	for h in *.h; do \
308		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
309		    ${DESTDIR}${INCLUDEDIR}/netinet; \
310	done
311.endif
312.if ${MK_PF} != "no"
313	cd ${.CURDIR}/../sys/netpfil/pf; \
314	for h in *.h; do \
315		ln -fs ../../../../sys/netpfil/pf/$$h \
316		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
317	done
318.endif
319	cd ${.CURDIR}/../sys/crypto; \
320	for h in rijndael/rijndael.h; do \
321		ln -fs ../../../sys/crypto/$$h \
322		    ${DESTDIR}${INCLUDEDIR}/crypto; \
323	done
324	cd ${.CURDIR}/../sys/opencrypto; \
325	for h in *.h; do \
326		ln -fs ../../../sys/opencrypto/$$h \
327		    ${DESTDIR}${INCLUDEDIR}/crypto; \
328	done
329	cd ${.CURDIR}/../sys/${MACHINE}/include; \
330	for h in *.h; do \
331		ln -fs ../../../sys/${MACHINE}/include/$$h \
332		    ${DESTDIR}${INCLUDEDIR}/machine; \
333	done
334.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
335	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
336	for h in *.h; do \
337		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
338		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
339	done
340.endif
341.for _MARCH in ${_MARCHS}
342.if exists(${.CURDIR}/../sys/${_MARCH}/include)
343	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
344	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
345	cd ${.CURDIR}/../sys/${_MARCH}/include; \
346	for h in *.h; do \
347		ln -fs ../../../sys/${_MARCH}/include/$$h \
348		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
349	done
350.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
351	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
352	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
353	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
354	for h in *.h; do \
355		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
356		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
357	done
358.endif
359.endif
360.endfor
361	cd ${.CURDIR}/../sys/fs/cd9660; \
362	for h in *.h; do \
363		ln -fs ../../../../sys/fs/cd9660/$$h \
364		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
365	done
366	cd ${.CURDIR}/../sys/rpc; \
367	for h in types.h; do \
368		ln -fs ../../../sys/rpc/$$h \
369		    ${DESTDIR}${INCLUDEDIR}/rpc; \
370	done
371.if ${MK_META_MODE} == "yes"
372	touch ${.TARGET}
373.endif
374