Makefile revision 241636
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 241636 2012-10-17 11:30:00Z 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/nullfs \
47	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# Define SHARED to indicate whether you want symbolic links to the system
85# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
86# probably only useful for developers and should be avoided if you do not
87# wish to tie your /usr/include and /usr/src together.
88#SHARED=	symlinks
89SHARED?=	copies
90
91INCS+=	osreldate.h
92
93osreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
94    ${.CURDIR}/Makefile
95	@${ECHO} creating osreldate.h from newvers.sh
96	@MAKE=${MAKE}; \
97	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
98	. ${.CURDIR}/../sys/conf/newvers.sh; \
99	echo "$$COPYRIGHT" > osreldate.h; \
100	echo "#ifdef _KERNEL" >> osreldate.h; \
101	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
102	echo "#else" >> osreldate.h; \
103	echo "#undef __FreeBSD_version" >> osreldate.h; \
104	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
105	echo "#endif" >> osreldate.h
106
107.for i in ${LHDRS}
108INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
109.endfor
110.for i in ${MHDRS}
111INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
112.endfor
113.for i in ${PHDRS}
114INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
115.endfor
116
117.if ${MACHINE} != ${MACHINE_CPUARCH}
118_MARCHS=	${MACHINE_CPUARCH}
119.endif
120.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
121_MARCHS+=	x86
122.endif
123
124.include <bsd.prog.mk>
125
126installincludes: ${SHARED}
127${SHARED}: compat
128
129# Take care of stale directory-level symlinks.
130compat:
131.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
132	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
133		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
134	fi
135.endfor
136	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
137	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
138	    -p ${DESTDIR}${INCLUDEDIR}
139.if ${MK_BIND_LIBS} != "no"
140	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
141	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
142	    -p ${DESTDIR}${INCLUDEDIR}
143.endif
144
145copies:
146.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
147	${_MARCHS}
148.if exists(${DESTDIR}${INCLUDEDIR}/$i)
149	cd ${DESTDIR}${INCLUDEDIR}/$i; \
150	for h in *.h; do \
151		if [ -L $$h ]; then rm -f $$h; fi; \
152	done
153.endif
154.endfor
155.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr:Ndev/nand} ${LSUBSUBDIRS}
156	cd ${.CURDIR}/../sys; \
157	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
158	    ${DESTDIR}${INCLUDEDIR}/$i
159.endfor
160	cd ${.CURDIR}/../sys/dev/acpica; \
161	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
162	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
163	cd ${.CURDIR}/../sys/dev/bktr; \
164	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
165	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
166.if ${MK_NAND} != "no"
167	cd ${.CURDIR}/../sys/dev/nand; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
169	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
170	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
171	    ${DESTDIR}${INCLUDEDIR}/dev/nand
172.endif
173	cd ${.CURDIR}/../sys/contrib/altq/altq; \
174	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
175	    ${DESTDIR}${INCLUDEDIR}/altq
176	cd ${.CURDIR}/../sys/fs/cd9660/; \
177	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
178	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
179.if ${MK_IPFILTER} != "no"
180	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
181	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
182	    ${DESTDIR}${INCLUDEDIR}/netinet
183.endif
184	cd ${.CURDIR}/../sys/crypto; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
186	    ${DESTDIR}${INCLUDEDIR}/crypto
187	cd ${.CURDIR}/../sys/opencrypto; \
188	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
189	    ${DESTDIR}${INCLUDEDIR}/crypto
190	cd ${.CURDIR}/../sys/${MACHINE}/include; \
191	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
192	    ${DESTDIR}${INCLUDEDIR}/machine
193.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
194	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
195	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
196	    ${DESTDIR}${INCLUDEDIR}/machine/pc
197.endif
198.for _MARCH in ${_MARCHS}
199.if exists(${.CURDIR}/../sys/${_MARCH}/include)
200	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
201	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
202	cd ${.CURDIR}/../sys/${_MARCH}/include; \
203	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
204	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
205.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
206	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
207	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
208	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
209	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
210	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
211.endif
212.endif
213.endfor
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:Ndev/nand}
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.if ${MK_NAND} != "no"
243	cd ${.CURDIR}/../sys/dev/nand; \
244	for h in nandsim.h nand_dev.h; do \
245		ln -fs ../../../../sys/dev/nand/$$h \
246		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
247	done
248.endif
249.for i in ${LSUBSUBDIRS}
250	cd ${.CURDIR}/../sys/$i; \
251	for h in *.h; do \
252		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
253	done
254.endfor
255	cd ${.CURDIR}/../sys/contrib/altq/altq; \
256	for h in *.h; do \
257		ln -fs ../../../sys/contrib/altq/altq/$$h \
258		    ${DESTDIR}${INCLUDEDIR}/altq; \
259	done
260.if ${MK_IPFILTER} != "no"
261	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
262	for h in *.h; do \
263		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
264		    ${DESTDIR}${INCLUDEDIR}/netinet; \
265	done
266.endif
267	cd ${.CURDIR}/../sys/crypto; \
268	for h in rijndael/rijndael.h; do \
269		ln -fs ../../../sys/crypto/$$h \
270		    ${DESTDIR}${INCLUDEDIR}/crypto; \
271	done
272	cd ${.CURDIR}/../sys/opencrypto; \
273	for h in *.h; do \
274		ln -fs ../../../sys/opencrypto/$$h \
275		    ${DESTDIR}${INCLUDEDIR}/crypto; \
276	done
277	cd ${.CURDIR}/../sys/${MACHINE}/include; \
278	for h in *.h; do \
279		ln -fs ../../../sys/${MACHINE}/include/$$h \
280		    ${DESTDIR}${INCLUDEDIR}/machine; \
281	done
282.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
283	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
284	for h in *.h; do \
285		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
286		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
287	done
288.endif
289.for _MARCH in ${_MARCHS}
290.if exists(${.CURDIR}/../sys/${_MARCH}/include)
291	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
292	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
293	cd ${.CURDIR}/../sys/${_MARCH}/include; \
294	for h in *.h; do \
295		ln -fs ../../../sys/${_MARCH}/include/$$h \
296		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
297	done
298.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
299	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
300	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
301	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
302	for h in *.h; do \
303		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
304		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
305	done
306.endif
307.endif
308.endfor
309	cd ${.CURDIR}/../sys/fs/cd9660; \
310	for h in *.h; do \
311		ln -fs ../../../../sys/fs/cd9660/$$h \
312		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
313	done
314	cd ${.CURDIR}/../sys/rpc; \
315	for h in types.h; do \
316		ln -fs ../../../sys/rpc/$$h \
317		    ${DESTDIR}${INCLUDEDIR}/rpc; \
318	done
319