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