xref: /freebsd/include/Makefile (revision 76390742ee98416ebfe9a99ced44a774f6a6b24e)
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	histedit.h 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 regexp.h \
21	res_update.h resolv.h runetype.h search.h setjmp.h sgtty.h \
22	signal.h stab.h \
23	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27	wctype.h wordexp.h
28
29I4BHDRS=i4b_cause.h i4b_debug.h i4b_ioctl.h i4b_rbch_ioctl.h \
30	i4b_tel_ioctl.h i4b_trace.h
31
32MHDRS=	float.h floatingpoint.h stdarg.h
33
34PHDRS=	sched.h semaphore.h _semaphore.h
35
36LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
37	termios.h ucontext.h
38
39LDIRS=	bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
40	netipsec ${_netipx} netnatm ${_netncp} netsmb \
41	nfs nfsclient nfsserver \
42	pccard sys vm
43
44LSUBDIRS=	cam/scsi \
45	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
46	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
47	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
48	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
49	${_fs_nwfs} fs/portalfs 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/nop geom/raid3 geom/shsec geom/stripe \
52	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
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
59.if ${MACHINE_ARCH} == "powerpc"
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_BLUETOOTH} != "no"
72LSUBSUBDIRS=	netgraph/bluetooth/include
73.endif
74
75# XXX unconditionally needed by <netsmb/netbios.h>
76#.if ${MK_IPX} != "no"
77_netipx=	netipx
78#.endif
79
80.if ${MK_NCP} != "no"
81_netncp=	netncp
82_fs_nwfs=	fs/nwfs
83.endif
84
85# Define SHARED to indicate whether you want symbolic links to the system
86# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
87# probably only useful for developers and should be avoided if you do not
88# wish to tie your /usr/include and /usr/src together.
89#SHARED=	symlinks
90SHARED?=	copies
91
92INCS+=	osreldate.h
93
94osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
95    ${.CURDIR}/Makefile
96	@${ECHO} creating osreldate.h from newvers.sh
97	@MAKE=${MAKE}; \
98	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
99	. ${.CURDIR}/../sys/conf/newvers.sh; \
100	echo "$$COPYRIGHT" > osreldate.h; \
101	echo "#ifdef _KERNEL" >> osreldate.h; \
102	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
103	echo "#else" >> osreldate.h; \
104	echo "#undef __FreeBSD_version" >> osreldate.h; \
105	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
106	echo "#endif" >> osreldate.h
107
108.for i in ${LHDRS}
109INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
110.endfor
111.for i in ${MHDRS}
112INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
113.endfor
114.for i in ${PHDRS}
115INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
116.endfor
117
118.if ${MACHINE} != ${MACHINE_ARCH}
119_MARCH=${MACHINE_ARCH}
120.endif
121
122.include <bsd.prog.mk>
123
124installincludes: ${SHARED}
125${SHARED}: compat
126
127# Take care of stale directory-level symlinks.
128compat:
129.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
130	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
131		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
132	fi
133.endfor
134	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
135	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
136	    -p ${DESTDIR}${INCLUDEDIR}
137.if ${MK_BIND_LIBS} != "no"
138	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
139	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
140	    -p ${DESTDIR}${INCLUDEDIR}
141.endif
142
143copies:
144.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
145	${_MARCH}
146.if exists(${DESTDIR}${INCLUDEDIR}/$i)
147	cd ${DESTDIR}${INCLUDEDIR}/$i; \
148	for h in *.h; do \
149		if [ -L $$h ]; then rm -f $$h; fi; \
150	done
151.endif
152.endfor
153.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
154	cd ${.CURDIR}/../sys; \
155	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
156	    ${DESTDIR}${INCLUDEDIR}/$i
157.endfor
158	cd ${.CURDIR}/../sys/dev/acpica; \
159	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
160	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
161	cd ${.CURDIR}/../sys/dev/bktr; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
163	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
164	cd ${.CURDIR}/../sys/contrib/altq/altq; \
165	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
166	    ${DESTDIR}${INCLUDEDIR}/altq
167	cd ${.CURDIR}/../sys/fs/cd9660/; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
170.if ${MK_IPFILTER} != "no"
171	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173	    ${DESTDIR}${INCLUDEDIR}/netinet
174.endif
175	cd ${.CURDIR}/../sys/contrib/pf/net; \
176	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
177	    ${DESTDIR}${INCLUDEDIR}/net
178	cd ${.CURDIR}/../sys/crypto; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
180	    ${DESTDIR}${INCLUDEDIR}/crypto
181.if ${MACHINE_ARCH} == "i386"
182.if ${MK_I4B} != "no"
183	cd ${.CURDIR}/../sys/i4b/include; \
184	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${I4BHDRS} \
185	    ${DESTDIR}${INCLUDEDIR}/i4b
186.endif
187.endif
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.if defined(_MARCH)
200	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
201	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
202	cd ${.CURDIR}/../sys/${_MARCH}/include; \
203	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
204	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
205.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
206	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
207	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
208	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
209	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
211.endif
212.endif
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}
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.for i in ${LSUBSUBDIRS}
242	cd ${.CURDIR}/../sys/$i; \
243	for h in *.h; do \
244		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
245	done
246.endfor
247	cd ${.CURDIR}/../sys/contrib/altq/altq; \
248	for h in *.h; do \
249		ln -fs ../../../sys/contrib/altq/altq/$$h \
250		    ${DESTDIR}${INCLUDEDIR}/altq; \
251	done
252.if ${MK_IPFILTER} != "no"
253	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
254	for h in *.h; do \
255		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
256		    ${DESTDIR}${INCLUDEDIR}/netinet; \
257	done
258.endif
259	cd ${.CURDIR}/../sys/contrib/pf/net; \
260	for h in *.h; do \
261		ln -fs ../../../sys/contrib/pf/net/$$h \
262		    ${DESTDIR}${INCLUDEDIR}/net; \
263	done
264	cd ${.CURDIR}/../sys/crypto; \
265	for h in rijndael/rijndael.h; do \
266		ln -fs ../../../sys/crypto/$$h \
267		    ${DESTDIR}${INCLUDEDIR}/crypto; \
268	done
269	cd ${.CURDIR}/../sys/i4b/include; \
270	for h in ${I4BHDRS}; do \
271		ln -fs ../../../sys/i4b/include/$$h \
272		    ${DESTDIR}${INCLUDEDIR}/i4b; \
273	done
274	cd ${.CURDIR}/../sys/opencrypto; \
275	for h in *.h; do \
276		ln -fs ../../../sys/opencrypto/$$h \
277		    ${DESTDIR}${INCLUDEDIR}/crypto; \
278	done
279	cd ${.CURDIR}/../sys/${MACHINE}/include; \
280	for h in *.h; do \
281		ln -fs ../../../sys/${MACHINE}/include/$$h \
282		    ${DESTDIR}${INCLUDEDIR}/machine; \
283	done
284.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
285	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
286	for h in *.h; do \
287		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
288		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
289	done
290.endif
291.if defined(_MARCH)
292	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
293	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
294	cd ${.CURDIR}/../sys/${_MARCH}/include; \
295	for h in *.h; do \
296		ln -fs ../../../sys/${_MARCH}/include/$$h \
297		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
298	done
299.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
300	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
301	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
302	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
303	for h in *.h; do \
304		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
305		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
306	done
307.endif
308.endif
309	cd ${.CURDIR}/../sys/fs/cd9660; \
310	for h in *.h; do \
311		ln -fs ../../../../sys/fs/cd9660/$$h \
312		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
313	done
314	cd ${.CURDIR}/../sys/rpc; \
315	for h in types.h; do \
316		ln -fs ../../../sys/rpc/$$h \
317		    ${DESTDIR}${INCLUDEDIR}/rpc; \
318	done
319