xref: /freebsd/include/Makefile (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
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 netgraph netinet netinet6 \
40	netipsec ${_netipx} netnatm ${_netncp} netsmb \
41	nfs nfsclient nfsserver \
42	pccard sys vm
43#LDIRS+=	netatm
44
45LSUBDIRS=	cam/scsi \
46	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
47	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
48	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
49	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
50	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
51	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
52	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
53	geom/mirror geom/multipath geom/nop \
54	geom/raid3 geom/shsec geom/stripe geom/virstor \
55	netgraph/atm netgraph/netflow \
56	security/audit \
57	security/mac_biba security/mac_bsdextended security/mac_lomac \
58	security/mac_mls security/mac_partition \
59	ufs/ffs ufs/ufs
60#LSUBDIRS+=	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni
61
62.if ${MACHINE_ARCH} == "powerpc"
63_dev_powermac_nvram=	dev/powermac_nvram
64.endif
65
66.if ${MK_GPIB} != "no"
67_dev_ieee488=	dev/ieee488
68.endif
69
70.if ${MK_HESIOD} != "no"
71INCS+=	hesiod.h
72.endif
73
74.if ${MK_BLUETOOTH} != "no"
75LSUBSUBDIRS=	netgraph/bluetooth/include
76.endif
77
78# XXX unconditionally needed by <netsmb/netbios.h>
79#.if ${MK_IPX} != "no"
80_netipx=	netipx
81#.endif
82
83.if ${MK_NCP} != "no"
84_netncp=	netncp
85_fs_nwfs=	fs/nwfs
86.endif
87
88# Define SHARED to indicate whether you want symbolic links to the system
89# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
90# probably only useful for developers and should be avoided if you do not
91# wish to tie your /usr/include and /usr/src together.
92#SHARED=	symlinks
93SHARED?=	copies
94
95INCS+=	osreldate.h
96
97osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
98    ${.CURDIR}/Makefile
99	@${ECHO} creating osreldate.h from newvers.sh
100	@MAKE=${MAKE}; \
101	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
102	. ${.CURDIR}/../sys/conf/newvers.sh; \
103	echo "$$COPYRIGHT" > osreldate.h; \
104	echo "#ifdef _KERNEL" >> osreldate.h; \
105	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
106	echo "#else" >> osreldate.h; \
107	echo "#undef __FreeBSD_version" >> osreldate.h; \
108	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
109	echo "#endif" >> osreldate.h
110
111.for i in ${LHDRS}
112INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
113.endfor
114.for i in ${MHDRS}
115INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
116.endfor
117.for i in ${PHDRS}
118INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
119.endfor
120
121.if ${MACHINE} != ${MACHINE_ARCH}
122_MARCH=${MACHINE_ARCH}
123.endif
124
125.include <bsd.prog.mk>
126
127installincludes: ${SHARED}
128${SHARED}: compat
129
130# Take care of stale directory-level symlinks.
131compat:
132.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
133	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
134		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
135	fi
136.endfor
137	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
138	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
139	    -p ${DESTDIR}${INCLUDEDIR}
140.if ${MK_BIND_LIBS} != "no"
141	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
142	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
143	    -p ${DESTDIR}${INCLUDEDIR}
144.endif
145
146copies:
147.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
148	${_MARCH}
149.if exists(${DESTDIR}${INCLUDEDIR}/$i)
150	cd ${DESTDIR}${INCLUDEDIR}/$i; \
151	for h in *.h; do \
152		if [ -L $$h ]; then rm -f $$h; fi; \
153	done
154.endif
155.endfor
156.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
157	cd ${.CURDIR}/../sys; \
158	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
159	    ${DESTDIR}${INCLUDEDIR}/$i
160.endfor
161	cd ${.CURDIR}/../sys/dev/acpica; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
163	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
164	cd ${.CURDIR}/../sys/dev/bktr; \
165	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
166	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
167	cd ${.CURDIR}/../sys/contrib/altq/altq; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169	    ${DESTDIR}${INCLUDEDIR}/altq
170	cd ${.CURDIR}/../sys/fs/cd9660/; \
171	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
172	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
173.if ${MK_IPFILTER} != "no"
174	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
176	    ${DESTDIR}${INCLUDEDIR}/netinet
177.endif
178	cd ${.CURDIR}/../sys/contrib/pf/net; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180	    ${DESTDIR}${INCLUDEDIR}/net
181	cd ${.CURDIR}/../sys/crypto; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
183	    ${DESTDIR}${INCLUDEDIR}/crypto
184.if ${MACHINE_ARCH} == "i386"
185.if ${MK_I4B} != "no"
186	cd ${.CURDIR}/../sys/i4b/include; \
187	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${I4BHDRS} \
188	    ${DESTDIR}${INCLUDEDIR}/i4b
189.endif
190.endif
191	cd ${.CURDIR}/../sys/opencrypto; \
192	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193	    ${DESTDIR}${INCLUDEDIR}/crypto
194	cd ${.CURDIR}/../sys/${MACHINE}/include; \
195	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
196	    ${DESTDIR}${INCLUDEDIR}/machine
197.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
198	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
199	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
200	    ${DESTDIR}${INCLUDEDIR}/machine/pc
201.endif
202.if defined(_MARCH)
203	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
204	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
205	cd ${.CURDIR}/../sys/${_MARCH}/include; \
206	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
208.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
209	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
210	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
211	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
212	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
213	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
214.endif
215.endif
216	cd ${.CURDIR}/../sys/rpc; \
217	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
218	    ${DESTDIR}${INCLUDEDIR}/rpc
219
220symlinks:
221	@${ECHO} "Setting up symlinks to kernel source tree..."
222.for i in ${LDIRS}
223	cd ${.CURDIR}/../sys/$i; \
224	for h in *.h; do \
225		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
226	done
227.endfor
228.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
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	cd ${.CURDIR}/../sys/dev/acpica; \
235	for h in acpiio.h; do \
236		ln -fs ../../../../sys/dev/acpica/$$h \
237		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
238	done
239	cd ${.CURDIR}/../sys/dev/bktr; \
240	for h in ioctl_*.h; do \
241		ln -fs ../../../../sys/dev/bktr/$$h \
242		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
243	done
244.for i in ${LSUBSUBDIRS}
245	cd ${.CURDIR}/../sys/$i; \
246	for h in *.h; do \
247		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
248	done
249.endfor
250	cd ${.CURDIR}/../sys/contrib/altq/altq; \
251	for h in *.h; do \
252		ln -fs ../../../sys/contrib/altq/altq/$$h \
253		    ${DESTDIR}${INCLUDEDIR}/altq; \
254	done
255.if ${MK_IPFILTER} != "no"
256	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
257	for h in *.h; do \
258		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
259		    ${DESTDIR}${INCLUDEDIR}/netinet; \
260	done
261.endif
262	cd ${.CURDIR}/../sys/contrib/pf/net; \
263	for h in *.h; do \
264		ln -fs ../../../sys/contrib/pf/net/$$h \
265		    ${DESTDIR}${INCLUDEDIR}/net; \
266	done
267	cd ${.CURDIR}/../sys/crypto; \
268	for h in rijndael/rijndael.h; do \
269		ln -fs ../../../sys/crypto/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/crypto; \
271	done
272	cd ${.CURDIR}/../sys/i4b/include; \
273	for h in ${I4BHDRS}; do \
274		ln -fs ../../../sys/i4b/include/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/i4b; \
276	done
277	cd ${.CURDIR}/../sys/opencrypto; \
278	for h in *.h; do \
279		ln -fs ../../../sys/opencrypto/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/crypto; \
281	done
282	cd ${.CURDIR}/../sys/${MACHINE}/include; \
283	for h in *.h; do \
284		ln -fs ../../../sys/${MACHINE}/include/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/machine; \
286	done
287.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
288	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
289	for h in *.h; do \
290		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
291		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
292	done
293.endif
294.if defined(_MARCH)
295	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
296	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
297	cd ${.CURDIR}/../sys/${_MARCH}/include; \
298	for h in *.h; do \
299		ln -fs ../../../sys/${_MARCH}/include/$$h \
300		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
301	done
302.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
303	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
304	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
305	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
306	for h in *.h; do \
307		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
308		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
309	done
310.endif
311.endif
312	cd ${.CURDIR}/../sys/fs/cd9660; \
313	for h in *.h; do \
314		ln -fs ../../../../sys/fs/cd9660/$$h \
315		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
316	done
317	cd ${.CURDIR}/../sys/rpc; \
318	for h in types.h; do \
319		ln -fs ../../../sys/rpc/$$h \
320		    ${DESTDIR}${INCLUDEDIR}/rpc; \
321	done
322