Makefile revision 17900
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
217900Speter#	$Id: Makefile,v 1.40 1996/08/20 08:19:33 julian Exp $
31539Srgrimes#
41539Srgrimes# Doing a make install builds /usr/include
51539Srgrimes#
61539Srgrimes# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
71539Srgrimes# links.
81539Srgrimes#
94019Satsall depend lint tags:
101539Srgrimes
119512SrgrimesCLEANFILES=version vers.c
121833SwollmanSUBDIR= rpcsvc
131539SrgrimesFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
147387Sjkh	err.h f2c.h fnmatch.h fstab.h fts.h glob.h grp.h strhash.h histedit.h \
157387Sjkh	kvm.h limits.h link.h locale.h malloc.h memory.h mpool.h ndbm.h \
1617706Sjulian	netdb.h nl_types.h nlist.h paths.h pthread.h pthread_np.h pwd.h \
1717706Sjulian	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h sgtty.h \
1817706Sjulian	signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
1917706Sjulian	struct.h sysexits.h tar.h time.h timers.h ttyent.h unistd.h utime.h \
201539Srgrimes	utmp.h vis.h
217242Sphk.if defined(WANT_CSRG_LIBM)
222573SbdeFILES+=	math.h
232573Sbde.endif
241539Srgrimes
2517900SpeterARPAFILES=	ftp.h inet.h nameser.h telnet.h tftp.h
2617900Speter
2717900SpeterPROTOFILES=	dumprestore.h routed.h rwhod.h talkd.h timed.h
2817900Speter
2917900SpeterRPCFILES=	auth.h auth_unix.h clnt.h pmap_clnt.h pmap_prot.h pmap_rmt.h \
3017900Speter		rpc.h rpc_msg.h svc.h svc_auth.h types.h xdr.h
3117900Speter
323329SbdeMFILES=	float.h floatingpoint.h stdarg.h varargs.h
331539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
341539Srgrimes
3517038SacheLDIRS=  net netatalk netinet netipx netkey nfs pccard sys vm #netccitt netiso netns
3617900Speter
371570SrgrimesLUDIR=	ufs
381570SrgrimesUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
391539Srgrimes
401539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
411539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
421539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
431539Srgrimes# SHARED=	copies
441570SrgrimesSHARED?=	symlinks
451539Srgrimes
461917Swollmanbeforeinstall: ${SHARED}
4717900Speter	cd ${.CURDIR}; \
4817900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
4917900Speter		${FILES} ${DESTDIR}/usr/include
5017900Speter	cd ${.CURDIR}/arpa; \
5117900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
5217900Speter		${ARPAFILES} ${DESTDIR}/usr/include/arpa
5317900Speter	cd ${.CURDIR}/protocols; \
5417900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
5517900Speter		${PROTOFILES} ${DESTDIR}/usr/include/protocols
5617900Speter	@rm -f osreldate.h
577152Sphk.if exists (${.CURDIR}/../sys/conf/newvers.sh)
587152Sphk	@${ECHO} creating osreldate.h from newvers.sh
5917432Swosch	. ${.CURDIR}/../sys/conf/newvers.sh;			\
6017900Speter	echo "$$COPYRIGHT" > osreldate.h;			\
6117900Speter	echo \#'undef __FreeBSD_version' >> osreldate.h;	\
6217900Speter	echo \#'define __FreeBSD_version' $$RELDATE >> osreldate.h
637152Sphk.else
647152Sphk	@${ECHO} creating osreldate.h from sysctl info
6517900Speter	@echo \#'undef __FreeBSD_version' > osreldate.h
662004Swollman	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
6717900Speter		>> osreldate.h
687152Sphk.endif
6917900Speter	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 osreldate.h \
7017900Speter		${DESTDIR}/usr/include
7117900Speter.for i in ${LFILES}
7217900Speter	ln -sf sys/$i ${DESTDIR}/usr/include/$i
7317900Speter.endfor
7417900Speter.for i in ${MFILES}
7517900Speter	ln -sf machine/$i ${DESTDIR}/usr/include/$i
7617900Speter.endfor
771539Srgrimes
781539Srgrimescopies:
7917900Speter.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
8017900Speter	if [ -h ${DESTDIR}/usr/include/$i ]; then \
8117900Speter		rm -f ${DESTDIR}/usr/include/$i; \
8217900Speter	fi
8317900Speter.endfor
8417900Speter.for i in ${LDIRS} ${UDIRS} ${LUDIR} machine
8517900Speter	if [ ! -d ${DESTDIR}/usr/include/$i ]; then \
8617900Speter		mkdir ${DESTDIR}/usr/include/$i; \
8717900Speter		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$i; \
8817900Speter		chmod 755 ${DESTDIR}/usr/include/$i; \
8917900Speter	fi
9017900Speter.endfor
9117900Speter.for i in ${LDIRS} ${UDIRS}
9217900Speter	cd ${.CURDIR}/../sys; \
9317900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
9417900Speter		${DESTDIR}/usr/include/$i
9517900Speter.endfor
9617900Speter.if exists(${.CURDIR}/../sys/${MACHINE}/include)
9717900Speter	cd ${.CURDIR}/../sys/${MACHINE}/include; \
9817900Speter		${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
9917900Speter		${DESTDIR}/usr/include/machine
10017900Speter.endif
1011539Srgrimes
1021539Srgrimessymlinks:
10317900Speter	@echo "Setting up symlinks to kernel source tree..."
10417900Speter.for i in ${LDIRS} ${LUDIR}
10517900Speter	rm -rf ${DESTDIR}/usr/include/$i && \
10617900Speter		ln -s /sys/$i ${DESTDIR}/usr/include/$i
10717900Speter.endfor
10817900Speter	rm -rf ${DESTDIR}/usr/include/machine && \
10917900Speter		ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1101539Srgrimes
1111539Srgrimes.include <bsd.prog.mk>
112