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