xref: /freebsd/include/Makefile (revision 63dab8eed99114670445270e26cf7193fe55e0fa)
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
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 _xlocale_ctype.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/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/fifofs fs/msdosfs 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} ${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	cd ${.CURDIR}/../sys/contrib/altq/altq; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173	    ${DESTDIR}${INCLUDEDIR}/altq
174	cd ${.CURDIR}/../sys/fs/cd9660/; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
176	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
177.if ${MK_IPFILTER} != "no"
178	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180	    ${DESTDIR}${INCLUDEDIR}/netinet
181.endif
182	cd ${.CURDIR}/../sys/contrib/pf/net; \
183	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184	    ${DESTDIR}${INCLUDEDIR}/net
185	cd ${.CURDIR}/../sys/crypto; \
186	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
187	    ${DESTDIR}${INCLUDEDIR}/crypto
188	cd ${.CURDIR}/../sys/opencrypto; \
189	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
190	    ${DESTDIR}${INCLUDEDIR}/crypto
191	cd ${.CURDIR}/../sys/${MACHINE}/include; \
192	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193	    ${DESTDIR}${INCLUDEDIR}/machine
194.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
195	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
196	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197	    ${DESTDIR}${INCLUDEDIR}/machine/pc
198.endif
199.for _MARCH in ${_MARCHS}
200.if exists(${.CURDIR}/../sys/${_MARCH}/include)
201	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
202	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
203	cd ${.CURDIR}/../sys/${_MARCH}/include; \
204	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
205	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
206.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
207	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
208	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
209	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
210	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
211	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
212.endif
213.endif
214.endfor
215	cd ${.CURDIR}/../sys/rpc; \
216	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
217	    ${DESTDIR}${INCLUDEDIR}/rpc
218
219symlinks:
220	@${ECHO} "Setting up symlinks to kernel source tree..."
221.for i in ${LDIRS}
222	cd ${.CURDIR}/../sys/$i; \
223	for h in *.h; do \
224		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
225	done
226.endfor
227.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
228	cd ${.CURDIR}/../sys/$i; \
229	for h in *.h; do \
230		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
231	done
232.endfor
233	cd ${.CURDIR}/../sys/dev/acpica; \
234	for h in acpiio.h; do \
235		ln -fs ../../../../sys/dev/acpica/$$h \
236		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
237	done
238	cd ${.CURDIR}/../sys/dev/bktr; \
239	for h in ioctl_*.h; do \
240		ln -fs ../../../../sys/dev/bktr/$$h \
241		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
242	done
243.for i in ${LSUBSUBDIRS}
244	cd ${.CURDIR}/../sys/$i; \
245	for h in *.h; do \
246		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
247	done
248.endfor
249	cd ${.CURDIR}/../sys/contrib/altq/altq; \
250	for h in *.h; do \
251		ln -fs ../../../sys/contrib/altq/altq/$$h \
252		    ${DESTDIR}${INCLUDEDIR}/altq; \
253	done
254.if ${MK_IPFILTER} != "no"
255	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
256	for h in *.h; do \
257		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
258		    ${DESTDIR}${INCLUDEDIR}/netinet; \
259	done
260.endif
261	cd ${.CURDIR}/../sys/contrib/pf/net; \
262	for h in *.h; do \
263		ln -fs ../../../sys/contrib/pf/net/$$h \
264		    ${DESTDIR}${INCLUDEDIR}/net; \
265	done
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