xref: /freebsd/include/Makefile (revision c243e4902be8df1e643c76b5f18b68bb77cc5268)
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 ${_netncp} netsmb \
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/ofw \
44	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/ntfs fs/nullfs \
47	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs 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# XXX unconditionally needed by <netsmb/netbios.h>
80#.if ${MK_IPX} != "no"
81_netipx=	netipx
82#.endif
83
84.if ${MK_NCP} != "no"
85_netncp=	netncp
86_fs_nwfs=	fs/nwfs
87.endif
88
89# Define SHARED to indicate whether you want symbolic links to the system
90# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
91# probably only useful for developers and should be avoided if you do not
92# wish to tie your /usr/include and /usr/src together.
93#SHARED=	symlinks
94SHARED?=	copies
95
96INCS+=	osreldate.h
97
98osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
99    ${.CURDIR}/Makefile
100	@${ECHO} creating osreldate.h from newvers.sh
101	@MAKE=${MAKE}; \
102	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
103	. ${.CURDIR}/../sys/conf/newvers.sh; \
104	echo "$$COPYRIGHT" > osreldate.h; \
105	echo "#ifdef _KERNEL" >> osreldate.h; \
106	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
107	echo "#else" >> osreldate.h; \
108	echo "#undef __FreeBSD_version" >> osreldate.h; \
109	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
110	echo "#endif" >> osreldate.h
111
112.for i in ${LHDRS}
113INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
114.endfor
115.for i in ${MHDRS}
116INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
117.endfor
118.for i in ${PHDRS}
119INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
120.endfor
121
122.if ${MACHINE} != ${MACHINE_CPUARCH}
123_MARCHS=	${MACHINE_CPUARCH}
124.endif
125.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
126_MARCHS+=	x86
127.endif
128
129.include <bsd.prog.mk>
130
131installincludes: ${SHARED}
132${SHARED}: compat
133
134# Take care of stale directory-level symlinks.
135compat:
136.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
137	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
138		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
139	fi
140.endfor
141	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
142	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
143	    -p ${DESTDIR}${INCLUDEDIR}
144.if ${MK_BIND_LIBS} != "no"
145	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
146	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
147	    -p ${DESTDIR}${INCLUDEDIR}
148.endif
149
150copies:
151.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
152	${_MARCHS}
153.if exists(${DESTDIR}${INCLUDEDIR}/$i)
154	cd ${DESTDIR}${INCLUDEDIR}/$i; \
155	for h in *.h; do \
156		if [ -L $$h ]; then rm -f $$h; fi; \
157	done
158.endif
159.endfor
160.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
161	cd ${.CURDIR}/../sys; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
163	    ${DESTDIR}${INCLUDEDIR}/$i
164.endfor
165	cd ${.CURDIR}/../sys/dev/acpica; \
166	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
167	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
168	cd ${.CURDIR}/../sys/dev/bktr; \
169	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
170	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
171.if ${MK_NAND} != "no"
172	cd ${.CURDIR}/../sys/dev/nand; \
173	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
174	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
176	    ${DESTDIR}${INCLUDEDIR}/dev/nand
177.endif
178	cd ${.CURDIR}/../sys/contrib/altq/altq; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180	    ${DESTDIR}${INCLUDEDIR}/altq
181	cd ${.CURDIR}/../sys/fs/cd9660/; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
183	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
184.if ${MK_IPFILTER} != "no"
185	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
186	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
187	    ${DESTDIR}${INCLUDEDIR}/netinet
188.endif
189	cd ${.CURDIR}/../sys/contrib/pf/net; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
191	    ${DESTDIR}${INCLUDEDIR}/net
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
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/acpica:Ndev/bktr:Ndev/nand}
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/bktr; \
246	for h in ioctl_*.h; do \
247		ln -fs ../../../../sys/dev/bktr/$$h \
248		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
249	done
250.if ${MK_NAND} != "no"
251	cd ${.CURDIR}/../sys/dev/nand; \
252	for h in nandsim.h nand_dev.h; do \
253		ln -fs ../../../../sys/dev/nand/$$h \
254		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
255	done
256.endif
257.for i in ${LSUBSUBDIRS}
258	cd ${.CURDIR}/../sys/$i; \
259	for h in *.h; do \
260		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
261	done
262.endfor
263	cd ${.CURDIR}/../sys/contrib/altq/altq; \
264	for h in *.h; do \
265		ln -fs ../../../sys/contrib/altq/altq/$$h \
266		    ${DESTDIR}${INCLUDEDIR}/altq; \
267	done
268.if ${MK_IPFILTER} != "no"
269	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
270	for h in *.h; do \
271		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
272		    ${DESTDIR}${INCLUDEDIR}/netinet; \
273	done
274.endif
275	cd ${.CURDIR}/../sys/contrib/pf/net; \
276	for h in *.h; do \
277		ln -fs ../../../sys/contrib/pf/net/$$h \
278		    ${DESTDIR}${INCLUDEDIR}/net; \
279	done
280	cd ${.CURDIR}/../sys/crypto; \
281	for h in rijndael/rijndael.h; do \
282		ln -fs ../../../sys/crypto/$$h \
283		    ${DESTDIR}${INCLUDEDIR}/crypto; \
284	done
285	cd ${.CURDIR}/../sys/opencrypto; \
286	for h in *.h; do \
287		ln -fs ../../../sys/opencrypto/$$h \
288		    ${DESTDIR}${INCLUDEDIR}/crypto; \
289	done
290	cd ${.CURDIR}/../sys/${MACHINE}/include; \
291	for h in *.h; do \
292		ln -fs ../../../sys/${MACHINE}/include/$$h \
293		    ${DESTDIR}${INCLUDEDIR}/machine; \
294	done
295.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
296	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
297	for h in *.h; do \
298		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
299		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
300	done
301.endif
302.for _MARCH in ${_MARCHS}
303.if exists(${.CURDIR}/../sys/${_MARCH}/include)
304	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
305	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
306	cd ${.CURDIR}/../sys/${_MARCH}/include; \
307	for h in *.h; do \
308		ln -fs ../../../sys/${_MARCH}/include/$$h \
309		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
310	done
311.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
312	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
313	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
314	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
315	for h in *.h; do \
316		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
317		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
318	done
319.endif
320.endif
321.endfor
322	cd ${.CURDIR}/../sys/fs/cd9660; \
323	for h in *.h; do \
324		ln -fs ../../../../sys/fs/cd9660/$$h \
325		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
326	done
327	cd ${.CURDIR}/../sys/rpc; \
328	for h in types.h; do \
329		ln -fs ../../../sys/rpc/$$h \
330		    ${DESTDIR}${INCLUDEDIR}/rpc; \
331	done
332