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