Makefile revision 241606
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 241606 2012-10-16 09:59:10Z attilio $
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 xlocale
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	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 stdalign.h stdatomic.h stdbool.h stddef.h \
23	stdnoreturn.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 xlocale.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/ciss dev/filemon dev/firewire dev/hwpmc \
43	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
44	dev/ofw 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/msdosfs fs/nandfs fs/nfs fs/ntfs fs/nullfs \
47	${_fs_nwfs} 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/raid 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_ICONV} != "no"
72INCS+=	iconv.h
73.endif
74
75.if ${MK_BLUETOOTH} != "no"
76LSUBSUBDIRS+=	netgraph/bluetooth/include
77.endif
78
79# XXX unconditionally needed by <netsmb/netbios.h>
80#.if ${MK_IPX} != "no"
81_netipx=	netipx
82#.endif
83
84.if ${MK_NCP} != "no"
85_netncp=	netncp
86_fs_nwfs=	fs/nwfs
87.endif
88
89# Define SHARED to indicate whether you want symbolic links to the system
90# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
91# probably only useful for developers and should be avoided if you do not
92# wish to tie your /usr/include and /usr/src together.
93#SHARED=	symlinks
94SHARED?=	copies
95
96INCS+=	osreldate.h
97
98osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
99    ${.CURDIR}/Makefile
100	@${ECHO} creating osreldate.h from newvers.sh
101	@MAKE=${MAKE}; \
102	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
103	. ${.CURDIR}/../sys/conf/newvers.sh; \
104	echo "$$COPYRIGHT" > osreldate.h; \
105	echo "#ifdef _KERNEL" >> osreldate.h; \
106	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
107	echo "#else" >> osreldate.h; \
108	echo "#undef __FreeBSD_version" >> osreldate.h; \
109	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
110	echo "#endif" >> osreldate.h
111
112.for i in ${LHDRS}
113INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
114.endfor
115.for i in ${MHDRS}
116INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
117.endfor
118.for i in ${PHDRS}
119INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
120.endfor
121
122.if ${MACHINE} != ${MACHINE_CPUARCH}
123_MARCHS=	${MACHINE_CPUARCH}
124.endif
125.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
126_MARCHS+=	x86
127.endif
128
129.include <bsd.prog.mk>
130
131installincludes: ${SHARED}
132${SHARED}: compat
133
134# Take care of stale directory-level symlinks.
135compat:
136.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
137	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
138		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
139	fi
140.endfor
141	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
142	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
143	    -p ${DESTDIR}${INCLUDEDIR}
144.if ${MK_BIND_LIBS} != "no"
145	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
146	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
147	    -p ${DESTDIR}${INCLUDEDIR}
148.endif
149
150copies:
151.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
152	${_MARCHS}
153.if exists(${DESTDIR}${INCLUDEDIR}/$i)
154	cd ${DESTDIR}${INCLUDEDIR}/$i; \
155	for h in *.h; do \
156		if [ -L $$h ]; then rm -f $$h; fi; \
157	done
158.endif
159.endfor
160.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
161	cd ${.CURDIR}/../sys; \
162	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
163	    ${DESTDIR}${INCLUDEDIR}/$i
164.endfor
165	cd ${.CURDIR}/../sys/dev/acpica; \
166	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
167	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
168	cd ${.CURDIR}/../sys/dev/bktr; \
169	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
170	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
171.if ${MK_NAND} != "no"
172	cd ${.CURDIR}/../sys/dev/nand; \
173	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
174	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
176	    ${DESTDIR}${INCLUDEDIR}/dev/nand
177.endif
178	cd ${.CURDIR}/../sys/contrib/altq/altq; \
179	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
180	    ${DESTDIR}${INCLUDEDIR}/altq
181	cd ${.CURDIR}/../sys/fs/cd9660/; \
182	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
183	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
184.if ${MK_IPFILTER} != "no"
185	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
186	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
187	    ${DESTDIR}${INCLUDEDIR}/netinet
188.endif
189	cd ${.CURDIR}/../sys/crypto; \
190	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
191	    ${DESTDIR}${INCLUDEDIR}/crypto
192	cd ${.CURDIR}/../sys/opencrypto; \
193	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
194	    ${DESTDIR}${INCLUDEDIR}/crypto
195	cd ${.CURDIR}/../sys/${MACHINE}/include; \
196	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
197	    ${DESTDIR}${INCLUDEDIR}/machine
198.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
199	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
200	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201	    ${DESTDIR}${INCLUDEDIR}/machine/pc
202.endif
203.for _MARCH in ${_MARCHS}
204.if exists(${.CURDIR}/../sys/${_MARCH}/include)
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.endfor
219	cd ${.CURDIR}/../sys/rpc; \
220	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
221	    ${DESTDIR}${INCLUDEDIR}/rpc
222
223symlinks:
224	@${ECHO} "Setting up symlinks to kernel source tree..."
225.for i in ${LDIRS}
226	cd ${.CURDIR}/../sys/$i; \
227	for h in *.h; do \
228		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
229	done
230.endfor
231.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand}
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/dev/acpica; \
238	for h in acpiio.h; do \
239		ln -fs ../../../../sys/dev/acpica/$$h \
240		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
241	done
242	cd ${.CURDIR}/../sys/dev/bktr; \
243	for h in ioctl_*.h; do \
244		ln -fs ../../../../sys/dev/bktr/$$h \
245		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
246	done
247.if ${MK_NAND} != "no"
248	cd ${.CURDIR}/../sys/dev/nand; \
249	for h in nandsim.h nand_dev.h; do \
250		ln -fs ../../../../sys/dev/nand/$$h \
251		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
252	done
253.endif
254.for i in ${LSUBSUBDIRS}
255	cd ${.CURDIR}/../sys/$i; \
256	for h in *.h; do \
257		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
258	done
259.endfor
260	cd ${.CURDIR}/../sys/contrib/altq/altq; \
261	for h in *.h; do \
262		ln -fs ../../../sys/contrib/altq/altq/$$h \
263		    ${DESTDIR}${INCLUDEDIR}/altq; \
264	done
265.if ${MK_IPFILTER} != "no"
266	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
267	for h in *.h; do \
268		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
269		    ${DESTDIR}${INCLUDEDIR}/netinet; \
270	done
271.endif
272	cd ${.CURDIR}/../sys/crypto; \
273	for h in rijndael/rijndael.h; do \
274		ln -fs ../../../sys/crypto/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/crypto; \
276	done
277	cd ${.CURDIR}/../sys/opencrypto; \
278	for h in *.h; do \
279		ln -fs ../../../sys/opencrypto/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/crypto; \
281	done
282	cd ${.CURDIR}/../sys/${MACHINE}/include; \
283	for h in *.h; do \
284		ln -fs ../../../sys/${MACHINE}/include/$$h \
285		    ${DESTDIR}${INCLUDEDIR}/machine; \
286	done
287.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
288	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
289	for h in *.h; do \
290		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
291		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
292	done
293.endif
294.for _MARCH in ${_MARCHS}
295.if exists(${.CURDIR}/../sys/${_MARCH}/include)
296	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
297	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
298	cd ${.CURDIR}/../sys/${_MARCH}/include; \
299	for h in *.h; do \
300		ln -fs ../../../sys/${_MARCH}/include/$$h \
301		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
302	done
303.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
304	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
305	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
306	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
307	for h in *.h; do \
308		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
309		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
310	done
311.endif
312.endif
313.endfor
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