Makefile revision 218772
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 218772 2011-02-17 15:10:13Z kib $
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 \
21	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
22	signal.h spawn.h stab.h \
23	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24	strings.h sysexits.h tar.h termios.h tgmath.h \
25	time.h timeconv.h timers.h ttyent.h \
26	ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h vis.h \
27	wchar.h wctype.h wordexp.h
28
29MHDRS=	float.h floatingpoint.h stdarg.h
30
31PHDRS=	sched.h _semaphore.h
32
33LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
34	ucontext.h
35
36LDIRS=	bsm cam geom net net80211 netatalk netgraph netinet netinet6 \
37	netipsec ${_netipx} netnatm ${_netncp} netsmb \
38	nfs nfsclient nfsserver \
39	sys vm
40
41LSUBDIRS=	cam/ata cam/scsi \
42	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
43	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/ofw \
44	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus \
45	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
46	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/nfs fs/ntfs fs/nullfs \
47	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/unionfs \
48	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
49	geom/mirror geom/mountver geom/multipath geom/nop \
50	geom/raid3 geom/shsec geom/stripe geom/virstor \
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
57LSUBSUBDIRS=	dev/mpt/mpilib
58
59.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
60_dev_powermac_nvram=	dev/powermac_nvram
61.endif
62
63.if ${MK_GPIB} != "no"
64_dev_ieee488=	dev/ieee488
65.endif
66
67.if ${MK_HESIOD} != "no"
68INCS+=	hesiod.h
69.endif
70
71.if ${MK_BLUETOOTH} != "no"
72LSUBSUBDIRS+=	netgraph/bluetooth/include
73.endif
74
75# XXX unconditionally needed by <netsmb/netbios.h>
76#.if ${MK_IPX} != "no"
77_netipx=	netipx
78#.endif
79
80.if ${MK_NCP} != "no"
81_netncp=	netncp
82_fs_nwfs=	fs/nwfs
83.endif
84
85# Define SHARED to indicate whether you want symbolic links to the system
86# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
87# probably only useful for developers and should be avoided if you do not
88# wish to tie your /usr/include and /usr/src together.
89#SHARED=	symlinks
90SHARED?=	copies
91
92INCS+=	osreldate.h
93
94osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
95    ${.CURDIR}/Makefile
96	@${ECHO} creating osreldate.h from newvers.sh
97	@MAKE=${MAKE}; \
98	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
99	. ${.CURDIR}/../sys/conf/newvers.sh; \
100	echo "$$COPYRIGHT" > osreldate.h; \
101	echo "#ifdef _KERNEL" >> osreldate.h; \
102	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
103	echo "#else" >> osreldate.h; \
104	echo "#undef __FreeBSD_version" >> osreldate.h; \
105	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
106	echo "#endif" >> osreldate.h
107
108.for i in ${LHDRS}
109INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
110.endfor
111.for i in ${MHDRS}
112INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
113.endfor
114.for i in ${PHDRS}
115INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
116.endfor
117
118.if ${MACHINE} != ${MACHINE_CPUARCH}
119_MARCHS=	${MACHINE_CPUARCH}
120.endif
121.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
122_MARCHS+=	x86
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 ${_MARCHS} 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	${_MARCHS}
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	cd ${.CURDIR}/../sys/opencrypto; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
186	    ${DESTDIR}${INCLUDEDIR}/crypto
187	cd ${.CURDIR}/../sys/${MACHINE}/include; \
188	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
189	    ${DESTDIR}${INCLUDEDIR}/machine
190.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
191	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
192	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193	    ${DESTDIR}${INCLUDEDIR}/machine/pc
194.endif
195.for _MARCH in ${_MARCHS}
196.if exists(${.CURDIR}/../sys/${_MARCH}/include)
197	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
198	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
199	cd ${.CURDIR}/../sys/${_MARCH}/include; \
200	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
202.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
203	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
204	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
205	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
206	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
207	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
208.endif
209.endif
210.endfor
211	cd ${.CURDIR}/../sys/rpc; \
212	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
213	    ${DESTDIR}${INCLUDEDIR}/rpc
214
215symlinks:
216	@${ECHO} "Setting up symlinks to kernel source tree..."
217.for i in ${LDIRS}
218	cd ${.CURDIR}/../sys/$i; \
219	for h in *.h; do \
220		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
221	done
222.endfor
223.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
224	cd ${.CURDIR}/../sys/$i; \
225	for h in *.h; do \
226		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
227	done
228.endfor
229	cd ${.CURDIR}/../sys/dev/acpica; \
230	for h in acpiio.h; do \
231		ln -fs ../../../../sys/dev/acpica/$$h \
232		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
233	done
234	cd ${.CURDIR}/../sys/dev/bktr; \
235	for h in ioctl_*.h; do \
236		ln -fs ../../../../sys/dev/bktr/$$h \
237		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
238	done
239.for i in ${LSUBSUBDIRS}
240	cd ${.CURDIR}/../sys/$i; \
241	for h in *.h; do \
242		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
243	done
244.endfor
245	cd ${.CURDIR}/../sys/contrib/altq/altq; \
246	for h in *.h; do \
247		ln -fs ../../../sys/contrib/altq/altq/$$h \
248		    ${DESTDIR}${INCLUDEDIR}/altq; \
249	done
250.if ${MK_IPFILTER} != "no"
251	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
252	for h in *.h; do \
253		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
254		    ${DESTDIR}${INCLUDEDIR}/netinet; \
255	done
256.endif
257	cd ${.CURDIR}/../sys/contrib/pf/net; \
258	for h in *.h; do \
259		ln -fs ../../../sys/contrib/pf/net/$$h \
260		    ${DESTDIR}${INCLUDEDIR}/net; \
261	done
262	cd ${.CURDIR}/../sys/crypto; \
263	for h in rijndael/rijndael.h; do \
264		ln -fs ../../../sys/crypto/$$h \
265		    ${DESTDIR}${INCLUDEDIR}/crypto; \
266	done
267	cd ${.CURDIR}/../sys/opencrypto; \
268	for h in *.h; do \
269		ln -fs ../../../sys/opencrypto/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/crypto; \
271	done
272	cd ${.CURDIR}/../sys/${MACHINE}/include; \
273	for h in *.h; do \
274		ln -fs ../../../sys/${MACHINE}/include/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/machine; \
276	done
277.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
278	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
279	for h in *.h; do \
280		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
281		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
282	done
283.endif
284.for _MARCH in ${_MARCHS}
285.if exists(${.CURDIR}/../sys/${_MARCH}/include)
286	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
287	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
288	cd ${.CURDIR}/../sys/${_MARCH}/include; \
289	for h in *.h; do \
290		ln -fs ../../../sys/${_MARCH}/include/$$h \
291		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
292	done
293.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
294	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
295	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
296	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
297	for h in *.h; do \
298		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
299		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
300	done
301.endif
302.endif
303.endfor
304	cd ${.CURDIR}/../sys/fs/cd9660; \
305	for h in *.h; do \
306		ln -fs ../../../../sys/fs/cd9660/$$h \
307		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
308	done
309	cd ${.CURDIR}/../sys/rpc; \
310	for h in types.h; do \
311		ln -fs ../../../sys/rpc/$$h \
312		    ${DESTDIR}${INCLUDEDIR}/rpc; \
313	done
314