Makefile revision 77857
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 77857 2001-06-07 05:04:53Z jlemon $
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
4277162SruLDIRS=	cam net netatalk netatm netgraph netinet netinet6 \
4377223Sru	netipx netkey netnatm netncp netns netsmb nfs pccard posix4 \
4475415Sbp	sys vm
4517900Speter
4675415SbpLNOHEADERDIRS=	fs isofs ufs dev
4754351Smarcel
4877728SjoergLSUBDIRS=	cam/scsi dev/ic dev/ppbus dev/usb dev/wi \
4977223Sru	fs/fdescfs fs/fifofs fs/msdosfs fs/ntfs fs/nullfs fs/nwfs fs/portalfs \
5077162Sru	fs/procfs fs/smbfs fs/umapfs fs/unionfs isofs/cd9660 \
5177434Sphk	ufs/ffs ufs/ufs
5277031Sru
5377046Sru# For SHARED=symlinks, cam is a symlink, so cam/scsi is taken care of
5477046SruLSYMSUBDIRS=	${LSUBDIRS:Ncam/scsi}
5577046Sru
5654351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5754351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5854351Smarcel# probably only useful for developers and should be avoided if you do not
5954351Smarcel# wish to tie your /usr/include and /usr/src together.
6054351Smarcel#SHARED=	symlinks
6154351SmarcelSHARED?=	copies
6254351Smarcel
6325734Speterall:	osreldate.h
6425734Speter
6536283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6636283Seivind		${.CURDIR}/../sys/sys/param.h
6725734Speter	@${ECHO} creating osreldate.h from newvers.sh
6836283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6925734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
7025734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
7172673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
7272673Speter	echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
7372673Speter	echo "#else" >> osreldate.h;				\
7425734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7572673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7672673Speter	echo "#endif" >> osreldate.h
7725734Speter
7854351Smarcelbeforeinstall: ${SHARED}
7954351Smarcel	@rm -f ${DESTDIR}/usr/include/timepps.h
8017900Speter	cd ${.CURDIR}; \
8154351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8254351Smarcel		${FILES} ${DESTDIR}/usr/include
8317900Speter	cd ${.CURDIR}/arpa; \
8454351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8554351Smarcel		${ARPAFILES} ${DESTDIR}/usr/include/arpa
8617900Speter	cd ${.CURDIR}/protocols; \
8754351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8854351Smarcel		${PROTOFILES} ${DESTDIR}/usr/include/protocols
8954351Smarcel	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
9054351Smarcel		${.OBJDIR}/osreldate.h \
9154351Smarcel		${DESTDIR}/usr/include
9217900Speter.for i in ${LFILES}
9317900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
9417900Speter.endfor
9517900Speter.for i in ${MFILES}
9617900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
9717900Speter.endfor
9834030Sdufault.for i in ${PFILES}
9934030Sdufault	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
10034030Sdufault.endfor
10154351Smarcel
10254351Smarcelcopies:
10377046Sru.for i in ${LDIRS} ${LSYMSUBDIRS} machine
10454351Smarcel	if [ -h ${DESTDIR}/usr/include/$i ]; then \
10554351Smarcel		rm -f ${DESTDIR}/usr/include/$i; \
10654351Smarcel	fi
10754351Smarcel.endfor
10865885Sache	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
10954351Smarcel		-p ${DESTDIR}/usr/include
11054351Smarcel.for i in ${LDIRS} ${LSUBDIRS}
11154351Smarcel	cd ${.CURDIR}/../sys; \
11254351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
11354351Smarcel		${DESTDIR}/usr/include/$i
11454351Smarcel.endfor
11577854Sjlemon.if exists(${.CURDIR}/../sys/contrib/ipfilter/netinet)
11677854Sjlemon	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
11754351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
11877854Sjlemon		${DESTDIR}/usr/include/netinet
11954351Smarcel.endif
12077857Sjlemon.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
12177857Sjlemon	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
12277857Sjlemon		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
12377857Sjlemon		${DESTDIR}/usr/include/machine
12477857Sjlemon.endif
12550949Speter.for i in ${SFILES}
12650949Speter	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
12750949Speter.endfor
1281539Srgrimes
12954351Smarcelsymlinks:
13054351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
13156645Speter.for i in ${LDIRS}
13254351Smarcel	rm -rf ${DESTDIR}/usr/include/$i
13354351Smarcel	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
13454351Smarcel.endfor
13556645Speter.for i in ${LNOHEADERDIRS}
13656645Speter	rm -rf ${DESTDIR}/usr/include/$i
13777046Sru	mkdir ${DESTDIR}/usr/include/$i
13856645Speter.endfor
13977046Sru.for i in ${LSYMSUBDIRS}
14077046Sru	ln -s ../../../sys/$i ${DESTDIR}/usr/include/$i
14177046Sru.endfor
14254351Smarcel	rm -rf ${DESTDIR}/usr/include/machine
14354351Smarcel	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
14454351Smarcel
1451539Srgrimes.include <bsd.prog.mk>
146