Makefile revision 77031
140496Sbde#	@(#)Makefile	8.2 (Berkeley) 1/4/94
250473Speter# $FreeBSD: head/include/Makefile 77031 2001-05-23 09:42:29Z 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 \
4977031Sru	fs/fdesc fs/fifofs fs/nullfs fs/portal fs/procfs fs/smbfs \
5077031Sru	fs/umapfs fs/union isofs/cd9660 ufs/ffs ufs/mfs ufs/ufs
5177031Sru
5254351Smarcel# Define SHARED to indicate whether you want symbolic links to the system
5354351Smarcel# source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
5454351Smarcel# probably only useful for developers and should be avoided if you do not
5554351Smarcel# wish to tie your /usr/include and /usr/src together.
5654351Smarcel#SHARED=	symlinks
5754351SmarcelSHARED?=	copies
5854351Smarcel
5925734Speterall:	osreldate.h
6025734Speter
6136283Seivindosreldate.h:	${.CURDIR}/../sys/conf/newvers.sh \
6236283Seivind		${.CURDIR}/../sys/sys/param.h
6325734Speter	@${ECHO} creating osreldate.h from newvers.sh
6436283Seivind	setvar PARAMFILE ${.CURDIR}/../sys/sys/param.h; \
6525734Speter	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6625734Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6772673Speter	echo "#ifdef _KERNEL" >> osreldate.h;			\
6872673Speter	echo '#error "osreldate.h must not be used in the kernel, use sys/param.h"' >> osreldate.h; \
6972673Speter	echo "#else" >> osreldate.h;				\
7025734Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
7172673Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h; \
7272673Speter	echo "#endif" >> osreldate.h
7325734Speter
7454351Smarcelbeforeinstall: ${SHARED}
7554351Smarcel	@rm -f ${DESTDIR}/usr/include/timepps.h
7617900Speter	cd ${.CURDIR}; \
7754351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
7854351Smarcel		${FILES} ${DESTDIR}/usr/include
7917900Speter	cd ${.CURDIR}/arpa; \
8054351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8154351Smarcel		${ARPAFILES} ${DESTDIR}/usr/include/arpa
8217900Speter	cd ${.CURDIR}/protocols; \
8354351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8454351Smarcel		${PROTOFILES} ${DESTDIR}/usr/include/protocols
8554351Smarcel	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
8654351Smarcel		${.OBJDIR}/osreldate.h \
8754351Smarcel		${DESTDIR}/usr/include
8817900Speter.for i in ${LFILES}
8917900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
9017900Speter.endfor
9117900Speter.for i in ${MFILES}
9217900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
9317900Speter.endfor
9434030Sdufault.for i in ${PFILES}
9534030Sdufault	ln -sf posix4/$i ${DESTDIR}/usr/include/$i
9634030Sdufault.endfor
9754351Smarcel
9854351Smarcelcopies:
9976930Sru.for i in ${LDIRS} ${LNOHEADERDIRS} machine
10054351Smarcel	if [ -h ${DESTDIR}/usr/include/$i ]; then \
10154351Smarcel		rm -f ${DESTDIR}/usr/include/$i; \
10254351Smarcel	fi
10354351Smarcel.endfor
10465885Sache	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
10554351Smarcel		-p ${DESTDIR}/usr/include
10654351Smarcel.for i in ${LDIRS} ${LSUBDIRS}
10754351Smarcel	cd ${.CURDIR}/../sys; \
10854351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
10954351Smarcel		${DESTDIR}/usr/include/$i
11054351Smarcel.endfor
11154351Smarcel.if exists(${.CURDIR}/../sys/${MACHINE_ARCH}/include)
11254351Smarcel	cd ${.CURDIR}/../sys/${MACHINE_ARCH}/include; \
11354351Smarcel		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
11454351Smarcel		${DESTDIR}/usr/include/machine
11554351Smarcel.endif
11650949Speter.for i in ${SFILES}
11750949Speter	ln -sf ../sys/$i ${DESTDIR}/usr/include/machine/$i
11850949Speter.endfor
1191539Srgrimes
12054351Smarcelsymlinks:
12154351Smarcel	@${ECHO} "Setting up symlinks to kernel source tree..."
12256645Speter.for i in ${LDIRS}
12354351Smarcel	rm -rf ${DESTDIR}/usr/include/$i
12454351Smarcel	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
12554351Smarcel.endfor
12656645Speter.for i in ${LNOHEADERDIRS}
12756645Speter	rm -rf ${DESTDIR}/usr/include/$i
12876930Sru	ln -s ../../sys/$i ${DESTDIR}/usr/include/$i
12956645Speter.endfor
13054351Smarcel	rm -rf ${DESTDIR}/usr/include/machine
13154351Smarcel	ln -s ../../sys/${MACHINE_ARCH}/include ${DESTDIR}/usr/include/machine
13254351Smarcel
1331539Srgrimes.include <bsd.prog.mk>
134