Makefile revision 77046
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 77046 2001-05-23 16:49:02Z ru $
31539Srgrimes#
41539Srgrimes# Doing a make install builds /usr/include
554351Smarcel#
654351Smarcel# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
754351Smarcel# links.
81539Srgrimes
918420SbdeCLEANFILES= osreldate.h version vers.c
1074462SalfredSUBDIR= rpcsvc rpc
111539SrgrimesFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
1276317Sobrien	dlfcn.h elf.h elf-hints.h err.h fnmatch.h fstab.h \
1365532Snectar	fts.h glob.h grp.h strhash.h \
1472171Sphantom	hesiod.h histedit.h ieeefp.h ifaddrs.h iso646.h langinfo.h \
1565294Sdes	libgen.h limits.h link.h locale.h malloc.h memory.h mpool.h \
1674462Salfred	netconfig.h ndbm.h netdb.h nl_types.h nlist.h nsswitch.h objformat.h \
1734030Sdufault	paths.h pthread.h pthread_np.h pwd.h \
1862321Salfred	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h \
1962321Salfred	search.h setjmp.h sgtty.h \
2065918Sasmodai	signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
2170632Ssheldonh	stringlist.h strings.h sysexits.h tar.h time.h timers.h \
2276680Sru	ttyent.h unistd.h utime.h utmp.h vis.h wchar.h wctype.h
237242Sphk.if defined(WANT_CSRG_LIBM)
242573SbdeFILES+=	math.h
252573Sbde.endif
261539Srgrimes
2736890SpeterARPAFILES=	ftp.h inet.h nameser.h nameser_compat.h telnet.h tftp.h
2817900Speter
2917900SpeterPROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
3017900Speter
313329SbdeMFILES=	float.h floatingpoint.h stdarg.h varargs.h
3234030Sdufault
3334030Sdufault# posix4/aio.h conflicts with dysons and isn't installed:
3450949SpeterPFILES=	mqueue.h sched.h semaphore.h # aio.h
3534030Sdufault
3654351Smarcel# Only for default SHARED=copies case
3754351SmarcelSFILES=	soundcard.h joystick.h
3850914Speter
3964767SjhbLFILES=	aio.h errno.h fcntl.h inttypes.h linker_set.h poll.h syslog.h \
4064767Sjhb	termios.h ucontext.h
411539Srgrimes
4254351SmarcelLDIRS=	cam msdosfs net netatalk netatm netgraph netinet netinet6 \
4375415Sbp	netipx netkey netnatm netncp netns netsmb nfs ntfs nwfs pccard posix4 \
4475415Sbp	sys vm
4517900Speter
4675415SbpLNOHEADERDIRS=	fs isofs ufs dev
4754351Smarcel
4877031SruLSUBDIRS=	cam/scsi dev/ppbus dev/usb dev/wi \
4977043Sru	fs/fdescfs fs/fifofs fs/nullfs fs/portalfs fs/procfs fs/smbfs \
5077043Sru	fs/umapfs fs/unionfs isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs
5177031Sru
5277046Sru# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
5377046SruLSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
5477046Sru
5554351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5654351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5754351Smarcel# probably only useful for developers and should be avoided if you do not
5854351Smarcel# wish to tie your /usr/include and /usr/src together.
5954351Smarcel#SHARED=	symlinks
6054351SmarcelSHARED?=	copies
6154351Smarcel
6225734Speterall:	osreldate.h
6325734Speter
6436283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6536283Seivind		${.CURDIR}/../sys/sys/param.h
6625734Speter	@${ECHO} creating osreldate.h from newvers.sh
6736283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6825734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6925734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
7072673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
7172673Speter	echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
7272673Speter	echo "#else" >> osreldate.h;				\
7325734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7472673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7572673Speter	echo "#endif" >> osreldate.h
7625734Speter
7754351Smarcelbeforeinstall: ${SHARED}
7854351Smarcel	@rm -f ${DESTDIR}/usr/include/timepps.h
7917900Speter	cd ${.CURDIR}; \
8054351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8154351Smarcel		${FILES} ${DESTDIR}/usr/include
8217900Speter	cd ${.CURDIR}/arpa; \
8354351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8454351Smarcel		${ARPAFILES} ${DESTDIR}/usr/include/arpa
8517900Speter	cd ${.CURDIR}/protocols; \
8654351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8754351Smarcel		${PROTOFILES} ${DESTDIR}/usr/include/protocols
8854351Smarcel	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8954351Smarcel		${.OBJDIR}/osreldate.h \
9054351Smarcel		${DESTDIR}/usr/include
9117900Speter.for i in ${LFILES}
9217900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
9317900Speter.endfor
9417900Speter.for i in ${MFILES}
9517900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
9617900Speter.endfor
9734030Sdufault.for i in ${PFILES}
9834030Sdufault	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
9934030Sdufault.endfor
10054351Smarcel
10154351Smarcelcopies:
10277046Sru.for i in ${LDIRS} ${LSYMSUBDIRS} machine
10354351Smarcel	if [ -h ${DESTDIR}/usr/include/$i ]; then \
10454351Smarcel		rm -f ${DESTDIR}/usr/include/$i; \
10554351Smarcel	fi
10654351Smarcel.endfor
10765885Sache	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
10854351Smarcel		-p ${DESTDIR}/usr/include
10954351Smarcel.for i in ${LDIRS} ${LSUBDIRS}
11054351Smarcel	cd ${.CURDIR}/../sys; \
11154351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
11254351Smarcel		${DESTDIR}/usr/include/$i
11354351Smarcel.endfor
11454351Smarcel.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
11554351Smarcel	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
11654351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
11754351Smarcel		${DESTDIR}/usr/include/machine
11854351Smarcel.endif
11950949Speter.for i in ${SFILES}
12050949Speter	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
12150949Speter.endfor
1221539Srgrimes
12354351Smarcelsymlinks:
12454351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
12556645Speter.for i in ${LDIRS}
12654351Smarcel	rm -rf ${DESTDIR}/usr/include/$i
12754351Smarcel	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
12854351Smarcel.endfor
12956645Speter.for i in ${LNOHEADERDIRS}
13056645Speter	rm -rf ${DESTDIR}/usr/include/$i
13177046Sru	mkdir ${DESTDIR}/usr/include/$i
13256645Speter.endfor
13377046Sru.for i in ${LSYMSUBDIRS}
13477046Sru	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
13577046Sru.endfor
13654351Smarcel	rm -rf ${DESTDIR}/usr/include/machine
13754351Smarcel	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
13854351Smarcel
1391539Srgrimes.include <bsd.prog.mk>
140