Makefile revision 123288
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 123288 2003-12-08 07:22:42Z obrien $
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 \
10107046Smarcel	fts.h getopt.h glob.h grp.h hesiod.h histedit.h ieeefp.h ifaddrs.h \
11107046Smarcel	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
12107046Smarcel	locale.h malloc.h memory.h monetary.h mpool.h ndbm.h netconfig.h \
13113595Snectar	netdb.h nl_types.h nlist.h nss.h nsswitch.h objformat.h paths.h \
14113595Snectar	pthread.h \
15107046Smarcel	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h regexp.h \
16107046Smarcel	resolv.h rune.h runetype.h search.h setjmp.h sgtty.h signal.h stab.h \
17121640Speter	stdbool.h stddef.h stdio.h stdlib.h string.h stringlist.h \
18107046Smarcel	strings.h sysexits.h tar.h time.h timeconv.h timers.h ttyent.h \
19119630Skan	ulimit.h unistd.h utime.h utmp.h uuid.h varargs.h vis.h wchar.h \
20119630Skan	wctype.h wordexp.h
211539Srgrimes
22119630SkanMHDRS=	float.h floatingpoint.h stdarg.h
2334030Sdufault
24104219Smike# posix4/mqueue.h is useless without an implementation and isn't installed:
25104634SmikePHDRS=	sched.h semaphore.h _semaphore.h # mqueue.h
2634030Sdufault
2788055SruLHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdint.h syslog.h \
2864767Sjhb	termios.h ucontext.h
291539Srgrimes
30116948SsamLDIRS=	cam geom net net80211 netatalk netatm netgraph netinet netinet6 \
31116948Ssam	netipsec netipx netkey netnatm netncp netsmb nfs nfsclient nfsserver \
3283653Speter	pccard posix4 sys vm
3317900Speter
34123288SobrienLSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
35123288Sobrien	dev/ofw dev/ppbus dev/smbus dev/usb dev/wi dev/utopia fs/devfs \
3677223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
37122956Sscottl	fs/procfs fs/smbfs fs/udf fs/umapfs fs/unionfs isofs/cd9660 \
3893229Sru	netatm/ipatm netatm/sigpvc netatm/spans netatm/uni \
39116811Sharti	netgraph/atm security/mac_biba security/mac_bsdextended \
40116811Sharti	security/mac_lomac security/mac_mls security/mac_partition \
41116811Sharti	ufs/ffs ufs/ufs
4277031Sru
43114731SbdeLSUBSUBDIRS=	netgraph/bluetooth/include
44107139Sjulian
4554351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
4654351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
4754351Smarcel# probably only useful for developers and should be avoided if you do not
4854351Smarcel# wish to tie your /usr/include and /usr/src together.
4954351Smarcel#SHARED=	symlinks
5054351SmarcelSHARED?=	copies
5154351Smarcel
5296462SruINCS+=	osreldate.h
5325734Speter
5436283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
5578376Speter		${.CURDIR}/../sys/sys/param.h \
5678376Speter		${.CURDIR}/Makefile
5725734Speter	@${ECHO} creating osreldate.h from newvers.sh
58117236Sru	@setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
5925734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6025734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6172673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
62114731Sbde	echo '#error "<osreldate.h> cannot be used in the kernel, use <sys/param.h>"' >> osreldate.h; \
6372673Speter	echo "#else" >> osreldate.h;				\
6425734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6572673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
6672673Speter	echo "#endif" >> osreldate.h
6725734Speter
6888055Sru.for i in ${LHDRS}
6996462SruINCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
7017900Speter.endfor
7188055Sru.for i in ${MHDRS}
7296462SruINCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
7317900Speter.endfor
7488055Sru.for i in ${PHDRS}
7596462SruINCSLINKS+=	posix4/$i ${INCLUDEDIR}/$i
7634030Sdufault.endfor
7754351Smarcel
78114731Sbde.include <bsd.prog.mk>
79114731Sbde
80114731Sbdeinstallincludes: ${SHARED}
81114731Sbde${SHARED}: compat
82114731Sbde
83114731Sbde# Take care of stale directory-level symlinks.
84114731Sbdecompat:
85114731Sbde.for i in ${LDIRS} ${LSUBDIRS} machine crypto
86114731Sbde	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
87114731Sbde		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
8854351Smarcel	fi
8954351Smarcel.endfor
90114731Sbde	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
91114731Sbde	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
92114731Sbde	    -p ${DESTDIR}${INCLUDEDIR}
93114731Sbde
94114731Sbdecopies:
95114731Sbde.for i in ${LDIRS} ${LSUBDIRS} crypto machine machine/pc
96114731Sbde.if exists(${DESTDIR}${INCLUDEDIR}/$i)
97114731Sbde	cd ${DESTDIR}${INCLUDEDIR}/$i; \
98114731Sbde	for h in *.h; do \
99114731Sbde		if [ -L $$h ]; then rm -f $$h; fi; \
100114731Sbde	done
101114731Sbde.endif
102114731Sbde.endfor
103123288Sobrien.for i in ${LDIRS} ${LSUBDIRS:Ndev/bktr} ${LSUBSUBDIRS}
10454351Smarcel	cd ${.CURDIR}/../sys; \
105114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
106114731Sbde	    ${DESTDIR}${INCLUDEDIR}/$i
10754351Smarcel.endfor
108123288Sobrien	cd ${.CURDIR}/../sys/dev/bktr; \
109123288Sobrien	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
110123288Sobrien	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
111116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
112116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
113116734Sru	    ${DESTDIR}${INCLUDEDIR}/netinet
114116734Sru	cd ${.CURDIR}/../sys/opencrypto; \
115116734Sru	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
116114731Sbde	    ${DESTDIR}${INCLUDEDIR}/crypto
11777857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
118114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
119114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine
12093229Sru.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
12193229Sru	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
122114731Sbde	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
123114731Sbde	    ${DESTDIR}${INCLUDEDIR}/machine/pc
12477857Sjlemon.endif
1251539Srgrimes
12654351Smarcelsymlinks:
12754351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
12856645Speter.for i in ${LDIRS}
129114731Sbde	cd ${.CURDIR}/../sys/$i; \
130114731Sbde	for h in *.h; do \
131114731Sbde		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
132114731Sbde	done
13354351Smarcel.endfor
134114731Sbde.for i in ${LSUBDIRS}
135114731Sbde	cd ${.CURDIR}/../sys/$i; \
136114731Sbde	for h in *.h; do \
137114731Sbde		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
138114731Sbde	done
13977046Sru.endfor
140114731Sbde.for i in ${LSUBSUBDIRS}
141114731Sbde	cd ${.CURDIR}/../sys/$i; \
142114731Sbde	for h in *.h; do \
143114731Sbde		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
144114731Sbde	done
145114731Sbde.endfor
146116734Sru	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
147116734Sru	for h in *.h; do \
148116734Sru		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
149116734Sru		    ${DESTDIR}${INCLUDEDIR}/netinet; \
150116734Sru	done
151114731Sbde	cd ${.CURDIR}/../sys/opencrypto; \
152114731Sbde	for h in *.h; do \
153114731Sbde		ln -fs ../../../sys/opencrypto/$$h \
154114731Sbde		    ${DESTDIR}${INCLUDEDIR}/crypto; \
155114731Sbde	done
156114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
157114731Sbde	for h in *.h; do \
158114731Sbde		ln -fs ../../../sys/${MACHINE_ARCH}/include/$$h \
159114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine; \
160114731Sbde	done
161114731Sbde.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc)
162114731Sbde	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include/pc; \
163114731Sbde	for h in *.h; do \
164114731Sbde		ln -fs ../../../../sys/${MACHINE_ARCH}/include/pc/$$h \
165114731Sbde		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
166114731Sbde	done
167114731Sbde.endif
168