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