Makefile revision 133333
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 133333 2004-08-08 20:05:47Z stefanf $
31539Srgrimes#
4114731Sbde# Doing a "make install" builds /usr/include.
51539Srgrimes
618420SbdeCLEANFILES= osreldate.h version vers.c
796462SruSUBDIR= arpa protocols rpcsvc rpc
8101138SmikeINCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h ctype.h db.h \
9107046Smarcel	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
10131661Sdas	fts.h ftw.h getopt.h glob.h grp.h \
11131661Sdas	hesiod.h histedit.h ieeefp.h ifaddrs.h \
12107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
13107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
14113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
15132173Sdavidxu	proc_service.h pthread.h \
16107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
17107046Smarcel	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
18121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
19133333Sstefanf	strings.h sysexits.h tar.h tgmath.h \
20133333Sstefanf	time.h timeconv.h timers.h ttyent.h \
21119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
22119630Skan	wctype.h wordexp.h
231539Srgrimes
24119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
2534030Sdufault
26104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
27104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2834030Sdufault
2988055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
3064767Sjhb	termios.h ucontext.h
311539Srgrimes
32116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
33116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3483653Speter	pccard posix4 sys vm
3517900Speter
36123288SobrienLSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
37123288Sobrien	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
3877223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
39128769Spjd	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs \
40132905Spjd	geom/concat geom/gate geom/label geom/mirror geom/nop geom/stripe \
41128769Spjd	isofs/cd9660 netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
42116811Sharti	netgraph/atm security/mac_biba security/mac_bsdextended \
43116811Sharti	security/mac_lomac security/mac_mls security/mac_partition \
44116811Sharti	ufs/ffs ufs/ufs
4577031Sru
46125123Semax.if !defined(NO_BLUETOOTH)
47114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
48125123Semax.endif
49107139Sjulian
5054351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5154351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5254351Smarcel# probably only useful for developers and should be avoided if you do not
5354351Smarcel# wish to tie your /usr/include and /usr/src together.
5454351Smarcel#SHARED=	symlinks
5554351SmarcelSHARED?=	copies
5654351Smarcel
5796462SruINCS+=	osreldate.h
5825734Speter
5936283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6078376Speter		${.CURDIR}/../sys/sys/param.h \
6178376Speter		${.CURDIR}/Makefile
6225734Speter	@${ECHO} creating osreldate.h from newvers.sh
63117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6425734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6525734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6672673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
67114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
6872673Speter	echo "#else" >> osreldate.h;				\
6925734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7072673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7172673Speter	echo "#endif" >> osreldate.h
7225734Speter
7388055Sru.for i in ${LHDRS}
7496462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7517900Speter.endfor
7688055Sru.for i in ${MHDRS}
7796462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7817900Speter.endfor
7988055Sru.for i in ${PHDRS}
8096462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
8134030Sdufault.endfor
8254351Smarcel
83114731Sbde.include <bsd.prog.mk>
84114731Sbde
85114731Sbdeinstallincludes: ${SHARED}
86114731Sbde${SHARED}: compat
87114731Sbde
88114731Sbde# Take care of stale directory-level symlinks.
89114731Sbdecompat:
90114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
91114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
92114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
9354351Smarcel	fi
9454351Smarcel.endfor
95114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
96114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
97114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
98114731Sbde
99114731Sbdecopies:
100114731Sbde.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
101114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
102114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
103114731Sbde	for h in *.h; do \
104114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
105114731Sbde	done
106114731Sbde.endif
107114731Sbde.endfor
108123288Sobrien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
10954351Smarcel	cd ${.CURDIR}/../sys; \
110114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
111114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
11254351Smarcel.endfor
113123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
114123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
115123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
116130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
117130416Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
118130416Smlaier	    ${DESTDIR}${INCLUDEDIR}/altq
119116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
120116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
121116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
122126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
123126385Smlaier	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
124126385Smlaier	    ${DESTDIR}${INCLUDEDIR}/net
125116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
126116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
127114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
12877857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
129114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
130114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
13193229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
13293229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
133114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
134114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
13577857Sjlemon.endif
1361539Srgrimes
13754351Smarcelsymlinks:
13854351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
13956645Speter.for i in ${LDIRS}
140114731Sbde	cd ${.CURDIR}/../sys/$i; \
141114731Sbde	for h in *.h; do \
142114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
143114731Sbde	done
14454351Smarcel.endfor
145114731Sbde.for i in ${LSUBDIRS}
146114731Sbde	cd ${.CURDIR}/../sys/$i; \
147114731Sbde	for h in *.h; do \
148114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
149114731Sbde	done
15077046Sru.endfor
151114731Sbde.for i in ${LSUBSUBDIRS}
152114731Sbde	cd ${.CURDIR}/../sys/$i; \
153114731Sbde	for h in *.h; do \
154114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
155114731Sbde	done
156114731Sbde.endfor
157130416Smlaier	cd ${.CURDIR}/../sys/contrib/altq/altq; \
158130416Smlaier	for h in *.h; do \
159130416Smlaier		ln -fs ../../../sys/contrib/altq/altq/$$h \
160130416Smlaier		    ${DESTDIR}${INCLUDEDIR}/altq; \
161130416Smlaier	done
162116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
163116734Sru	for h in *.h; do \
164116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
165116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
166116734Sru	done
167126385Smlaier	cd ${.CURDIR}/../sys/contrib/pf/net; \
168126385Smlaier	for h in *.h; do \
169126385Smlaier		ln -fs ../../../sys/contrib/pf/net/$$h \
170126385Smlaier		    ${DESTDIR}${INCLUDEDIR}/net; \
171126385Smlaier	done
172114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
173114731Sbde	for h in *.h; do \
174114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
175114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
176114731Sbde	done
177114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
178114731Sbde	for h in *.h; do \
179114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
180114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
181114731Sbde	done
182114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
183114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
184114731Sbde	for h in *.h; do \
185114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
186114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
187114731Sbde	done
188114731Sbde.endif
189