xref: /freebsd/include/Makefile (revision 48c5129f93c5eb5419c87b08e4677d51513f1dc0)
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD$
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 stdatomic.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	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
27	wchar.h wctype.h wordexp.h xlocale.h
28
29MHDRS=	float.h floatingpoint.h stdarg.h
30
31PHDRS=	sched.h _semaphore.h
32
33LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34	ucontext.h
35
36LDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
37	netipsec ${_netipx} netnatm \
38	nfs nfsclient nfsserver \
39	sys vm
40
41LSUBDIRS=	cam/ata cam/scsi \
42	dev/acpica dev/an dev/bktr dev/ciss dev/filemon dev/firewire dev/hwpmc \
43	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
44	dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
45	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
46	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
47	fs/procfs fs/udf fs/unionfs \
48	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
49	geom/mirror geom/mountver geom/multipath geom/nop \
50	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
51	netgraph/atm netgraph/netflow \
52	security/audit \
53	security/mac_biba security/mac_bsdextended security/mac_lomac \
54	security/mac_mls security/mac_partition \
55	ufs/ffs ufs/ufs
56
57LSUBSUBDIRS=	dev/mpt/mpilib
58
59.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
60_dev_powermac_nvram=	dev/powermac_nvram
61.endif
62
63.if ${MK_GPIB} != "no"
64_dev_ieee488=	dev/ieee488
65.endif
66
67.if ${MK_HESIOD} != "no"
68INCS+=	hesiod.h
69.endif
70
71.if ${MK_ICONV} != "no"
72INCS+=	iconv.h
73.endif
74
75.if ${MK_BLUETOOTH} != "no"
76LSUBSUBDIRS+=	netgraph/bluetooth/include
77.endif
78
79#.if ${MK_IPX} != "no"
80_netipx=	netipx
81#.endif
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
92osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
93    ${.CURDIR}/Makefile
94	@${ECHO} creating osreldate.h from newvers.sh
95	@MAKE=${MAKE}; \
96	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
97	. ${.CURDIR}/../sys/conf/newvers.sh; \
98	echo "$$COPYRIGHT" > osreldate.h; \
99	echo "#ifdef _KERNEL" >> osreldate.h; \
100	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
101	echo "#else" >> osreldate.h; \
102	echo "#undef __FreeBSD_version" >> osreldate.h; \
103	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
104	echo "#endif" >> osreldate.h
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.if ${MK_BIND_LIBS} != "no"
139	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
140	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
141	    -p ${DESTDIR}${INCLUDEDIR}
142.endif
143
144copies:
145.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
146	${_MARCHS}
147.if exists(${DESTDIR}${INCLUDEDIR}/$i)
148	cd ${DESTDIR}${INCLUDEDIR}/$i; \
149	for h in *.h; do \
150		if [ -L $$h ]; then rm -f $$h; fi; \
151	done
152.endif
153.endfor
154.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
155	cd ${.CURDIR}/../sys; \
156	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
157	    ${DESTDIR}${INCLUDEDIR}/$i
158.endfor
159	cd ${.CURDIR}/../sys/dev/acpica; \
160	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
161	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
162	cd ${.CURDIR}/../sys/dev/bktr; \
163	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
164	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
165.if ${MK_NAND} != "no"
166	cd ${.CURDIR}/../sys/dev/nand; \
167	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
168	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
169	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
170	    ${DESTDIR}${INCLUDEDIR}/dev/nand
171.endif
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	cd ${.CURDIR}/../sys/crypto; \
184	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
185	    ${DESTDIR}${INCLUDEDIR}/crypto
186	cd ${.CURDIR}/../sys/opencrypto; \
187	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
188	    ${DESTDIR}${INCLUDEDIR}/crypto
189	cd ${.CURDIR}/../sys/${MACHINE}/include; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191	    ${DESTDIR}${INCLUDEDIR}/machine
192.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
193	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
194	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195	    ${DESTDIR}${INCLUDEDIR}/machine/pc
196.endif
197.for _MARCH in ${_MARCHS}
198.if exists(${.CURDIR}/../sys/${_MARCH}/include)
199	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
200	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
201	cd ${.CURDIR}/../sys/${_MARCH}/include; \
202	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
203	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
204.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
205	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
206	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
207	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
208	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
209	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
210.endif
211.endif
212.endfor
213	cd ${.CURDIR}/../sys/rpc; \
214	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
215	    ${DESTDIR}${INCLUDEDIR}/rpc
216
217symlinks:
218	@${ECHO} "Setting up symlinks to kernel source tree..."
219.for i in ${LDIRS}
220	cd ${.CURDIR}/../sys/$i; \
221	for h in *.h; do \
222		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
223	done
224.endfor
225.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand}
226	cd ${.CURDIR}/../sys/$i; \
227	for h in *.h; do \
228		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
229	done
230.endfor
231	cd ${.CURDIR}/../sys/dev/acpica; \
232	for h in acpiio.h; do \
233		ln -fs ../../../../sys/dev/acpica/$$h \
234		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
235	done
236	cd ${.CURDIR}/../sys/dev/bktr; \
237	for h in ioctl_*.h; do \
238		ln -fs ../../../../sys/dev/bktr/$$h \
239		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
240	done
241.if ${MK_NAND} != "no"
242	cd ${.CURDIR}/../sys/dev/nand; \
243	for h in nandsim.h nand_dev.h; do \
244		ln -fs ../../../../sys/dev/nand/$$h \
245		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
246	done
247.endif
248.for i in ${LSUBSUBDIRS}
249	cd ${.CURDIR}/../sys/$i; \
250	for h in *.h; do \
251		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
252	done
253.endfor
254	cd ${.CURDIR}/../sys/contrib/altq/altq; \
255	for h in *.h; do \
256		ln -fs ../../../sys/contrib/altq/altq/$$h \
257		    ${DESTDIR}${INCLUDEDIR}/altq; \
258	done
259.if ${MK_IPFILTER} != "no"
260	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
261	for h in *.h; do \
262		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
263		    ${DESTDIR}${INCLUDEDIR}/netinet; \
264	done
265.endif
266	cd ${.CURDIR}/../sys/crypto; \
267	for h in rijndael/rijndael.h; do \
268		ln -fs ../../../sys/crypto/$$h \
269		    ${DESTDIR}${INCLUDEDIR}/crypto; \
270	done
271	cd ${.CURDIR}/../sys/opencrypto; \
272	for h in *.h; do \
273		ln -fs ../../../sys/opencrypto/$$h \
274		    ${DESTDIR}${INCLUDEDIR}/crypto; \
275	done
276	cd ${.CURDIR}/../sys/${MACHINE}/include; \
277	for h in *.h; do \
278		ln -fs ../../../sys/${MACHINE}/include/$$h \
279		    ${DESTDIR}${INCLUDEDIR}/machine; \
280	done
281.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
282	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
283	for h in *.h; do \
284		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
286	done
287.endif
288.for _MARCH in ${_MARCHS}
289.if exists(${.CURDIR}/../sys/${_MARCH}/include)
290	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
291	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
292	cd ${.CURDIR}/../sys/${_MARCH}/include; \
293	for h in *.h; do \
294		ln -fs ../../../sys/${_MARCH}/include/$$h \
295		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
296	done
297.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
298	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
299	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
300	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
301	for h in *.h; do \
302		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
303		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
304	done
305.endif
306.endif
307.endfor
308	cd ${.CURDIR}/../sys/fs/cd9660; \
309	for h in *.h; do \
310		ln -fs ../../../../sys/fs/cd9660/$$h \
311		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
312	done
313	cd ${.CURDIR}/../sys/rpc; \
314	for h in types.h; do \
315		ln -fs ../../../sys/rpc/$$h \
316		    ${DESTDIR}${INCLUDEDIR}/rpc; \
317	done
318