Makefile revision 141397
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 141397 2005-02-06 15:18:24Z phk $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
618420SbdeCLEANFILES= osreldate.h version vers.c
796462SruSUBDIR= arpa protocols rpcsvc rpc
8133567StjrINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
9133559Stjr	db.h \
10107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
11131661Sdas	fts.h ftw.h getopt.h glob.h grp.h \
12131661Sdas	hesiod.h histedit.h ieeefp.h ifaddrs.h \
13107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
14107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
15113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
16132173Sdavidxu	proc_service.h pthread.h \
17107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
18136609Stjr	resolv.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
19121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
20133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
21133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
22119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
23119630Skan	wctype.h wordexp.h
241539Srgrimes
25119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
2634030Sdufault
27104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
28104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2934030Sdufault
3088055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3164767Sjhb	termios.h ucontext.h
321539Srgrimes
33116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
34116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3583653Speter	pccard posix4 sys vm
3617900Speter
37140246SddsLSUBDIRS=	cam/scsi \
38141397Sphk	dev/an dev/bktr dev/firewire dev/ic dev/iicbus ${_dev_ieee488} dev/ofw \
39141397Sphk	dev/pbio dev/ppbus dev/smbus dev/usb dev/wi dev/utopia \
40140246Sdds	fs/devfs fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs \
41140246Sdds	fs/nwfs fs/portalfs fs/procfs fs/smbfs fs/udf fs/umapfs \
42140246Sdds	fs/unionfs \
43133812Spjd	geom/concat geom/gate geom/label geom/mirror geom/nop geom/raid3 \
44140084Spjd	geom/shsec geom/stripe \
45140246Sdds	isofs/cd9660 \
46140246Sdds	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
47135339Sglebius	netgraph/atm netgraph/netflow \
48135339Sglebius	security/mac_biba security/mac_bsdextended security/mac_lomac \
49135339Sglebius	security/mac_mls security/mac_partition \
50137556Smarkm	ufs/ffs ufs/ufs
5177031Sru
52141397Sphk.if !defined(NO_GPIB)
53141397Sphk_dev_ieee488=	dev/ieee488
54141397Sphk.endif
55141397Sphk
56125123Semax.if !defined(NO_BLUETOOTH)
57114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
58125123Semax.endif
59107139Sjulian
6054351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
6154351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
6254351Smarcel# probably only useful for developers and should be avoided if you do not
6354351Smarcel# wish to tie your /usr/include and /usr/src together.
6454351Smarcel#SHARED=	symlinks
6554351SmarcelSHARED?=	copies
6654351Smarcel
6796462SruINCS+=	osreldate.h
6825734Speter
6936283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
7078376Speter		${.CURDIR}/../sys/sys/param.h \
7178376Speter		${.CURDIR}/Makefile
7225734Speter	@${ECHO} creating osreldate.h from newvers.sh
73117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
74135371Sru	MAKE=${MAKE} . ${.CURDIR}/../sys/conf/newvers.sh;	\
7525734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
7672673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
77114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
7872673Speter	echo "#else" >> osreldate.h;				\
7925734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
8072673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
8172673Speter	echo "#endif" >> osreldate.h
8225734Speter
8388055Sru.for i in ${LHDRS}
8496462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
8517900Speter.endfor
8688055Sru.for i in ${MHDRS}
8796462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
8817900Speter.endfor
8988055Sru.for i in ${PHDRS}
9096462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
9134030Sdufault.endfor
9254351Smarcel
93114731Sbde.include <bsd.prog.mk>
94114731Sbde
95114731Sbdeinstallincludes: ${SHARED}
96114731Sbde${SHARED}: compat
97114731Sbde
98114731Sbde# Take care of stale directory-level symlinks.
99114731Sbdecompat:
100114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
101114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
102114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
10354351Smarcel	fi
10454351Smarcel.endfor
105114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
106114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
107114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
108135851Sdougb.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
109135851Sdougb	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
110135851Sdougb	    -f ${.CURDIR}/../etc/mtree/BIND.include.dist \
111135851Sdougb	    -p ${DESTDIR}${INCLUDEDIR}
112135851Sdougb.endif
113114731Sbde
114114731Sbdecopies:
115137836Sru.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc
116114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
117114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
118114731Sbde	for h in *.h; do \
119114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
120114731Sbde	done
121114731Sbde.endif
122114731Sbde.endfor
123123288Sobrien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
12454351Smarcel	cd ${.CURDIR}/../sys; \
125114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
126114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
12754351Smarcel.endfor
128123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
129123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
130123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
131130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
132130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
133130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
134116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
135116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
136116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
137126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
138126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
139126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
140116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
141116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
142114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
14377857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
144114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
145114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
14693229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
14793229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
148114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
149114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
15077857Sjlemon.endif
1511539Srgrimes
15254351Smarcelsymlinks:
15354351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
15456645Speter.for i in ${LDIRS}
155114731Sbde	cd ${.CURDIR}/../sys/$i; \
156114731Sbde	for h in *.h; do \
157114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
158114731Sbde	done
15954351Smarcel.endfor
160114731Sbde.for i in ${LSUBDIRS}
161114731Sbde	cd ${.CURDIR}/../sys/$i; \
162114731Sbde	for h in *.h; do \
163114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
164114731Sbde	done
16577046Sru.endfor
166114731Sbde.for i in ${LSUBSUBDIRS}
167114731Sbde	cd ${.CURDIR}/../sys/$i; \
168114731Sbde	for h in *.h; do \
169114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
170114731Sbde	done
171114731Sbde.endfor
172130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
173130416Smlaier	for h in *.h; do \
174130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
175130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
176130416Smlaier	done
177116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
178116734Sru	for h in *.h; do \
179116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
180116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
181116734Sru	done
182126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
183126385Smlaier	for h in *.h; do \
184126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
185126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
186126385Smlaier	done
187114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
188114731Sbde	for h in *.h; do \
189114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
190114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
191114731Sbde	done
192114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
193114731Sbde	for h in *.h; do \
194114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
195114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
196114731Sbde	done
197114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
198114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
199114731Sbde	for h in *.h; do \
200114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
201114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
202114731Sbde	done
203114731Sbde.endif
204