Makefile revision 168677
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 168677 2007-04-13 01:39:33Z pjd $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
6156813Sru.include <bsd.own.mk>
7156813Sru
818420SbdeCLEANFILES= osreldate.h version vers.c
9153838SdfrSUBDIR= arpa gssapi protocols rpcsvc rpc
10133567StjrINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
11133559Stjr	db.h \
12107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
13153838Sdfr	fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
14148796Sphk	histedit.h ieeefp.h ifaddrs.h \
15107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
16157236Sjasone	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
17152994Sru	ndbm.h netconfig.h \
18166243Speter	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
19153486Sphk	printf.h proc_service.h pthread.h \
20107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
21157308Sume	res_update.h resolv.h runetype.h search.h setjmp.h sgtty.h \
22142582Sru	signal.h stab.h \
23121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
24133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
25133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
26119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
27119630Skan	wctype.h wordexp.h
281539Srgrimes
29119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
3034030Sdufault
31152868SrodrigcPHDRS=	sched.h semaphore.h _semaphore.h
3234030Sdufault
3388055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3464767Sjhb	termios.h ucontext.h
351539Srgrimes
36146795SrwatsonLDIRS=	bsm cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
37156905Sru	netipsec ${_netipx} netkey netnatm ${_netncp} netsmb \
38156905Sru	nfs nfsclient nfsserver \
39168677Spjd	pccard sys vm
4017900Speter
41146795SrwatsonLSUBDIRS=	cam/scsi \
42147191Sjkoshy	dev/acpica dev/an dev/bktr dev/firewire dev/hwpmc \
43150850Sscottl	dev/ic dev/iicbus ${_dev_ieee488} dev/lmc dev/ofw \
44162117Semax	dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/smbus dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
45140246Sdds	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
46156905Sru	${_fs_nwfs} fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
47140246Sdds	fs/unionfs \
48163851Spjd	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
49163851Spjd	geom/mirror geom/nop geom/raid3 geom/shsec geom/stripe \
50140246Sdds	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
51135339Sglebius	netgraph/atm netgraph/netflow \
52156885Srwatson	security/audit \
53135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
54135339Sglebius	security/mac_mls security/mac_partition \
55137556Smarkm	ufs/ffs ufs/ufs
5677031Sru
57160892Ssobomax.if ${MACHINE_ARCH} == "powerpc"
58160892Ssobomax_dev_powermac_nvram=	dev/powermac_nvram
59160892Ssobomax.endif
60160892Ssobomax
61156813Sru.if ${MK_GPIB} != "no"
62141397Sphk_dev_ieee488=	dev/ieee488
63141397Sphk.endif
64141397Sphk
65156813Sru.if ${MK_HESIOD} != "no"
66148796SphkINCS+=	hesiod.h
67148796Sphk.endif
68148796Sphk
69156813Sru.if ${MK_BLUETOOTH} != "no"
70114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
71125123Semax.endif
72107139Sjulian
73156905Sru# XXX unconditionally needed by <netsmb/netbios.h>
74156905Sru#.if ${MK_IPX} != "no"
75156905Sru_netipx=	netipx
76156905Sru#.endif
77156905Sru
78156905Sru.if ${MK_NCP} != "no"
79156905Sru_netncp=	netncp
80156905Sru_fs_nwfs=	fs/nwfs
81156905Sru.endif
82156905Sru
8354351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
8454351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
8554351Smarcel# probably only useful for developers and should be avoided if you do not
8654351Smarcel# wish to tie your /usr/include and /usr/src together.
8754351Smarcel#SHARED=	symlinks
8854351SmarcelSHARED?=	copies
8954351Smarcel
9096462SruINCS+=	osreldate.h
9125734Speter
92156532Sruosreldate.h: ${.CURDIR}/../sys/conf/newvers.sh ${.CURDIR}/../sys/sys/param.h \
93156532Sru    ${.CURDIR}/Makefile
9425734Speter	@${ECHO} creating osreldate.h from newvers.sh
95156532Sru	@MAKE=${MAKE}; \
96156532Sru	PARAMFILE=${.CURDIR}/../sys/sys/param.h; \
97156532Sru	. ${.CURDIR}/../sys/conf/newvers.sh; \
98156531Sru	echo "$$COPYRIGHT" > osreldate.h; \
99156531Sru	echo "#ifdef _KERNEL" >> osreldate.h; \
100156532Sru	echo "#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"" >> osreldate.h; \
101156531Sru	echo "#else" >> osreldate.h; \
102156532Sru	echo "#undef __FreeBSD_version" >> osreldate.h; \
103156532Sru	echo "#define __FreeBSD_version $$RELDATE" >> osreldate.h; \
10472673Speter	echo "#endif" >> osreldate.h
10525734Speter
10688055Sru.for i in ${LHDRS}
10796462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
10817900Speter.endfor
10988055Sru.for i in ${MHDRS}
11096462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
11117900Speter.endfor
11288055Sru.for i in ${PHDRS}
113164184StrhodesINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
11434030Sdufault.endfor
11554351Smarcel
116144514Simp.if ${MACHINE} != ${MACHINE_ARCH}
117144514Simp_MARCH=${MACHINE_ARCH}
118144514Simp.endif
119144514Simp
120114731Sbde.include <bsd.prog.mk>
121114731Sbde
122114731Sbdeinstallincludes: ${SHARED}
123114731Sbde${SHARED}: compat
124114731Sbde
125114731Sbde# Take care of stale directory-level symlinks.
126114731Sbdecompat:
127144514Simp.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCH} crypto
128114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
129114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
13054351Smarcel	fi
13154351Smarcel.endfor
132114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
133114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
134114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
135156813Sru.if ${MK_BIND_LIBS} != "no"
136135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
137135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
138135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
139135851Sdougb.endif
140114731Sbde
141114731Sbdecopies:
142144514Simp.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
143144514Simp	${_MARCH}
144114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
145114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
146114731Sbde	for h in *.h; do \
147114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
148114731Sbde	done
149114731Sbde.endif
150114731Sbde.endfor
151143013Snjl.for i in ${LDIRS} ${LSUBDIRS:Ndev/acpica:Ndev/bktr} ${LSUBSUBDIRS}
15254351Smarcel	cd ${.CURDIR}/../sys; \
153114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
154114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
15554351Smarcel.endfor
156143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
157143013Snjl	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
158143013Snjl	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
159123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
160123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
161123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
162130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
163130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
164130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
165166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660/; \
166166640Srodrigc	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
167166640Srodrigc	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
168156813Sru.if ${MK_IPFILTER} != "no"
169116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
170116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
171116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
172145539Sscottl.endif
173126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
174126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
175126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
176143423Sume	cd ${.CURDIR}/../sys/crypto; \
177143423Sume	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
178143423Sume	    ${DESTDIR}${INCLUDEDIR}/crypto
179116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
180116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
181114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
182144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
183114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
184114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
185144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
186144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
187114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
188114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
18977857Sjlemon.endif
190144514Simp.if defined(_MARCH)
191144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
192144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
193144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
194144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
195144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
196144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
197144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
198144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
199144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
200144514Simp	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
201144514Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
202144514Simp.endif
203144514Simp.endif
204168677Spjd	cd ${.CURDIR}/../sys/rpc; \
205168677Spjd	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
206168677Spjd	    ${DESTDIR}${INCLUDEDIR}/rpc
2071539Srgrimes
20854351Smarcelsymlinks:
20954351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
21056645Speter.for i in ${LDIRS}
211114731Sbde	cd ${.CURDIR}/../sys/$i; \
212114731Sbde	for h in *.h; do \
213114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
214114731Sbde	done
21554351Smarcel.endfor
216143013Snjl.for i in ${LSUBDIRS:Ndev/acpica:Ndev/bktr}
217114731Sbde	cd ${.CURDIR}/../sys/$i; \
218114731Sbde	for h in *.h; do \
219114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
220114731Sbde	done
22177046Sru.endfor
222143013Snjl	cd ${.CURDIR}/../sys/dev/acpica; \
223143013Snjl	for h in acpiio.h; do \
224143013Snjl		ln -fs ../../../../sys/dev/acpica/$$h \
225143013Snjl		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
226143013Snjl	done
227142992Sru	cd ${.CURDIR}/../sys/dev/bktr; \
228142992Sru	for h in ioctl_*.h; do \
229142992Sru		ln -fs ../../../../sys/dev/bktr/$$h \
230142992Sru		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
231142992Sru	done
232114731Sbde.for i in ${LSUBSUBDIRS}
233114731Sbde	cd ${.CURDIR}/../sys/$i; \
234114731Sbde	for h in *.h; do \
235114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
236114731Sbde	done
237114731Sbde.endfor
238130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
239130416Smlaier	for h in *.h; do \
240130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
241130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
242130416Smlaier	done
243156813Sru.if ${MK_IPFILTER} != "no"
244116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
245116734Sru	for h in *.h; do \
246116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
247116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
248116734Sru	done
249145539Sscottl.endif
250126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
251126385Smlaier	for h in *.h; do \
252126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
253126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
254126385Smlaier	done
255143423Sume	cd ${.CURDIR}/../sys/crypto; \
256143423Sume	for h in rijndael/rijndael.h; do \
257143423Sume		ln -fs ../../../sys/crypto/$$h \
258143423Sume		    ${DESTDIR}${INCLUDEDIR}/crypto; \
259143423Sume	done
260114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
261114731Sbde	for h in *.h; do \
262114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
263114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
264114731Sbde	done
265144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include; \
266114731Sbde	for h in *.h; do \
267144514Simp		ln -fs ../../../sys/${MACHINE}/include/$$h \
268114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
269114731Sbde	done
270144514Simp.if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
271144514Simp	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
272114731Sbde	for h in *.h; do \
273144514Simp		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
274114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
275114731Sbde	done
276114731Sbde.endif
277144514Simp.if defined(_MARCH)
278144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
279144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
280144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include; \
281144514Simp	for h in *.h; do \
282144514Simp		ln -fs ../../../sys/${_MARCH}/include/$$h \
283144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
284144514Simp	done
285144514Simp.if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
286144561Simp	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
287144561Simp	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
288144514Simp	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
289144514Simp	for h in *.h; do \
290144514Simp		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
291144514Simp		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
292144514Simp	done
293144514Simp.endif
294144514Simp.endif
295166640Srodrigc	cd ${.CURDIR}/../sys/fs/cd9660; \
296166640Srodrigc	for h in *.h; do \
297166640Srodrigc		ln -fs ../../../../sys/fs/cd9660/$$h \
298166640Srodrigc		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
299166640Srodrigc	done
300168677Spjd	cd ${.CURDIR}/../sys/rpc; \
301168677Spjd	for h in types.h; do \
302168677Spjd		ln -fs ../../../sys/rpc/$$h \
303168677Spjd		    ${DESTDIR}${INCLUDEDIR}/rpc; \
304168677Spjd	done
305