Makefile revision 166243
1#	@(#)Makefile	8.2 (Berkeley) 1/4/94
2# $FreeBSD: head/include/Makefile 166243 2007-01-25 22:38:04Z peter $
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	isofs/cd9660 \
51	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
52	netgraph/atm netgraph/netflow \
53	security/audit \
54	security/mac_biba security/mac_bsdextended security/mac_lomac \
55	security/mac_mls security/mac_partition \
56	ufs/ffs ufs/ufs
57
58.if ${MACHINE_ARCH} == "powerpc"
59_dev_powermac_nvram=	dev/powermac_nvram
60.endif
61
62.if ${MK_GPIB} != "no"
63_dev_ieee488=	dev/ieee488
64.endif
65
66.if ${MK_HESIOD} != "no"
67INCS+=	hesiod.h
68.endif
69
70.if ${MK_BLUETOOTH} != "no"
71LSUBSUBDIRS=	netgraph/bluetooth/include
72.endif
73
74# XXX unconditionally needed by <netsmb/netbios.h>
75#.if ${MK_IPX} != "no"
76_netipx=	netipx
77#.endif
78
79.if ${MK_NCP} != "no"
80_netncp=	netncp
81_fs_nwfs=	fs/nwfs
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_ARCH}
118_MARCH=${MACHINE_ARCH}
119.endif
120
121.include <bsd.prog.mk>
122
123installincludes: ${SHARED}
124${SHARED}: compat
125
126# Take care of stale directory-level symlinks.
127compat:
128.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
129	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
130		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
131	fi
132.endfor
133	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
134	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
135	    -p ${DESTDIR}${INCLUDEDIR}
136.if ${MK_BIND_LIBS} != "no"
137	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
138	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
139	    -p ${DESTDIR}${INCLUDEDIR}
140.endif
141
142copies:
143.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
144	${_MARCH}
145.if exists(${DESTDIR}${INCLUDEDIR}/$i)
146	cd ${DESTDIR}${INCLUDEDIR}/$i; \
147	for h in *.h; do \
148		if [ -L $$h ]; then rm -f $$h; fi; \
149	done
150.endif
151.endfor
152.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
153	cd ${.CURDIR}/../sys; \
154	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
155	    ${DESTDIR}${INCLUDEDIR}/$i
156.endfor
157	cd ${.CURDIR}/../sys/dev/acpica; \
158	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
159	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
160	cd ${.CURDIR}/../sys/dev/bktr; \
161	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
162	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
163	cd ${.CURDIR}/../sys/contrib/altq/altq; \
164	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
165	    ${DESTDIR}${INCLUDEDIR}/altq
166.if ${MK_IPFILTER} != "no"
167	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
168	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
169	    ${DESTDIR}${INCLUDEDIR}/netinet
170.endif
171	cd ${.CURDIR}/../sys/contrib/pf/net; \
172	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
173	    ${DESTDIR}${INCLUDEDIR}/net
174	cd ${.CURDIR}/../sys/crypto; \
175	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
176	    ${DESTDIR}${INCLUDEDIR}/crypto
177	cd ${.CURDIR}/../sys/opencrypto; \
178	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
179	    ${DESTDIR}${INCLUDEDIR}/crypto
180	cd ${.CURDIR}/../sys/${MACHINE}/include; \
181	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
182	    ${DESTDIR}${INCLUDEDIR}/machine
183.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
184	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
185	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
186	    ${DESTDIR}${INCLUDEDIR}/machine/pc
187.endif
188.if defined(_MARCH)
189	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
190	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
191	cd ${.CURDIR}/../sys/${_MARCH}/include; \
192	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
193	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
194.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
195	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
196	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
197	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
198	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
199	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
200.endif
201.endif
202
203symlinks:
204	@${ECHO} "Setting up symlinks to kernel source tree..."
205.for i in ${LDIRS}
206	cd ${.CURDIR}/../sys/$i; \
207	for h in *.h; do \
208		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
209	done
210.endfor
211.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
212	cd ${.CURDIR}/../sys/$i; \
213	for h in *.h; do \
214		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
215	done
216.endfor
217	cd ${.CURDIR}/../sys/dev/acpica; \
218	for h in acpiio.h; do \
219		ln -fs ../../../../sys/dev/acpica/$$h \
220		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
221	done
222	cd ${.CURDIR}/../sys/dev/bktr; \
223	for h in ioctl_*.h; do \
224		ln -fs ../../../../sys/dev/bktr/$$h \
225		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
226	done
227.for i in ${LSUBSUBDIRS}
228	cd ${.CURDIR}/../sys/$i; \
229	for h in *.h; do \
230		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
231	done
232.endfor
233	cd ${.CURDIR}/../sys/contrib/altq/altq; \
234	for h in *.h; do \
235		ln -fs ../../../sys/contrib/altq/altq/$$h \
236		    ${DESTDIR}${INCLUDEDIR}/altq; \
237	done
238.if ${MK_IPFILTER} != "no"
239	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
240	for h in *.h; do \
241		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
242		    ${DESTDIR}${INCLUDEDIR}/netinet; \
243	done
244.endif
245	cd ${.CURDIR}/../sys/contrib/pf/net; \
246	for h in *.h; do \
247		ln -fs ../../../sys/contrib/pf/net/$$h \
248		    ${DESTDIR}${INCLUDEDIR}/net; \
249	done
250	cd ${.CURDIR}/../sys/crypto; \
251	for h in rijndael/rijndael.h; do \
252		ln -fs ../../../sys/crypto/$$h \
253		    ${DESTDIR}${INCLUDEDIR}/crypto; \
254	done
255	cd ${.CURDIR}/../sys/opencrypto; \
256	for h in *.h; do \
257		ln -fs ../../../sys/opencrypto/$$h \
258		    ${DESTDIR}${INCLUDEDIR}/crypto; \
259	done
260	cd ${.CURDIR}/../sys/${MACHINE}/include; \
261	for h in *.h; do \
262		ln -fs ../../../sys/${MACHINE}/include/$$h \
263		    ${DESTDIR}${INCLUDEDIR}/machine; \
264	done
265.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
266	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
267	for h in *.h; do \
268		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
269		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
270	done
271.endif
272.if defined(_MARCH)
273	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
274	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
275	cd ${.CURDIR}/../sys/${_MARCH}/include; \
276	for h in *.h; do \
277		ln -fs ../../../sys/${_MARCH}/include/$$h \
278		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
279	done
280.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
281	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
282	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
283	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
284	for h in *.h; do \
285		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
286		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
287	done
288.endif
289.endif
290