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