Makefile revision 3214
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
23211Spst#	$Id: Makefile,v 1.13 1994/09/15 20:07:18 bde 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#
91539Srgrimesall clean cleandir depend lint tags:
101539Srgrimes
111833SwollmanSUBDIR= rpcsvc
121604Srgrimes# XXX MISSING:	mp.h
131539SrgrimesFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
141841Swollman	err.h fnmatch.h fstab.h fts.h glob.h grp.h histedit.h kvm.h \
152573Sbde	limits.h link.h locale.h memory.h mpool.h ndbm.h \
162151Spaul	netdb.h nlist.h paths.h pwd.h ranlib.h regex.h regexp.h \
173211Spst	resolv.h rune.h runetype.h setjmp.h sgtty.h signal.h \
182151Spaul	stab.h stddef.h stdio.h stdlib.h string.h strings.h struct.h \
192151Spaul	sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
201539Srgrimes	utmp.h vis.h
212573Sbde.if !defined(WANT_MSUN)
222573SbdeFILES+=	math.h
232573Sbde.endif
241539Srgrimes
251833SwollmanMFILES=	float.h floatingpoint.h frame.h stdarg.h varargs.h
261539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
271539Srgrimes
281839SwollmanDIRS=	arpa protocols rpc
291570SrgrimesLDIRS=	net netccitt netinet netiso netns nfs sys vm
301570SrgrimesLUDIR=	ufs
311570SrgrimesUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
321539Srgrimes
331539SrgrimesNOOBJ=	noobj
341539Srgrimes
351539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
361539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
371539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
381539Srgrimes# SHARED=	copies
391570SrgrimesSHARED?=	symlinks
401539Srgrimes
413214SpstOSREL	= ${DESTDIR}/usr/include/osreldate.h
421917Swollmanbeforeinstall: ${SHARED}
432367Sbde	@${ECHO} installing ${FILES}
441539Srgrimes	@-for i in ${FILES}; do \
451539Srgrimes		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
461539Srgrimes		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
471539Srgrimes		    ${DESTDIR}/usr/include/$$i; \
481539Srgrimes	done
492367Sbde	@${ECHO} creating osreldate.h
503214Spst	@echo \#'undef __FreeBSD_version' > ${OSREL}.new
512004Swollman	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
523214Spst		>> ${OSREL}.new
533214Spst	@if cmp -s ${OSREL} ${OSREL}.new >/dev/null 2>&1 ; then \
543214Spst		rm -f ${OSREL}.new ; else \
553214Spst		mv -f ${OSREL}.new ${OSREL} ; fi
563214Spst	@chown ${BINOWN}.${BINGRP} ${OSREL}
573214Spst	@chmod 444 ${OSREL}
582367Sbde	@${ECHO} installing ${DIRS}
591539Srgrimes	@-for i in ${DIRS}; do \
601539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
611539Srgrimes		then \
621539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
631539Srgrimes		fi; \
641539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
651539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
661539Srgrimes		(cd $$i; for j in *.[ih]; do \
671539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
681539Srgrimes			    /dev/null 2>&1 || \
691539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
701539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
711539Srgrimes		done); \
721539Srgrimes	done
732367Sbde	@${ECHO} installing ${LFILES}
741539Srgrimes	@-for i in ${LFILES}; do \
751539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
761539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
771539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
781539Srgrimes	done
792367Sbde	@${ECHO} installing ${MFILES}
801539Srgrimes	@-for i in ${MFILES}; do \
811539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
821539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
831539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
841539Srgrimes	done
851539Srgrimes
861539Srgrimescopies:
871570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
881570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
892367Sbde		${ECHO} ${SHARED} $$i;					\
901570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
911570Srgrimes		cd ../sys;						\
921570Srgrimes		tar cf - $$i/*.h |					\
931570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
941570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
951570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
961570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
971539Srgrimes	done
981570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
991539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
1001570Srgrimes	cd ../sys/${MACHINE}/include && \
1011570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
1021570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
1031570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
1041570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
1051539Srgrimes
1061539Srgrimessymlinks:
1071570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
1082367Sbde		${ECHO} ${SHARED} $$i;					\
1091570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
1101570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
1111570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1121539Srgrimes	done
1131570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1141570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1151539Srgrimes
1161539Srgrimes.include <bsd.prog.mk>
117