Makefile revision 2367
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
22367Sbde#	$Id: Makefile,v 1.10 1994/08/20 12:00:06 paul 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 \
152151Spaul	limits.h link.h locale.h math.h memory.h mpool.h ndbm.h \
162151Spaul	netdb.h nlist.h paths.h pwd.h ranlib.h regex.h regexp.h \
172151Spaul	resolv.h rune.h runetype.h setjmp.h sgtty.h signal.h skey.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
211539Srgrimes
221833SwollmanMFILES=	float.h floatingpoint.h frame.h stdarg.h varargs.h
231539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
241539Srgrimes
251839SwollmanDIRS=	arpa protocols rpc
261570SrgrimesLDIRS=	net netccitt netinet netiso netns nfs sys vm
271570SrgrimesLUDIR=	ufs
281570SrgrimesUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
291539Srgrimes
301539SrgrimesNOOBJ=	noobj
311539Srgrimes
321539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
331539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
341539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
351539Srgrimes# SHARED=	copies
361570SrgrimesSHARED?=	symlinks
371539Srgrimes
381917Swollmanbeforeinstall: ${SHARED}
392367Sbde	@${ECHO} installing ${FILES}
401539Srgrimes	@-for i in ${FILES}; do \
411539Srgrimes		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
421539Srgrimes		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
431539Srgrimes		    ${DESTDIR}/usr/include/$$i; \
441539Srgrimes	done
452367Sbde	@${ECHO} creating osreldate.h
462004Swollman	@rm -f ${DESTDIR}/usr/include/osreldate.h
472004Swollman	@echo \#'undef __FreeBSD_version' > ${DESTDIR}/usr/include/osreldate.h
482004Swollman	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
492004Swollman		>> ${DESTDIR}/usr/include/osreldate.h
502367Sbde	@${ECHO} installing ${DIRS}
511539Srgrimes	@-for i in ${DIRS}; do \
521539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
531539Srgrimes		then \
541539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
551539Srgrimes		fi; \
561539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
571539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
581539Srgrimes		(cd $$i; for j in *.[ih]; do \
591539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
601539Srgrimes			    /dev/null 2>&1 || \
611539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
621539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
631539Srgrimes		done); \
641539Srgrimes	done
652367Sbde	@${ECHO} installing ${LFILES}
661539Srgrimes	@-for i in ${LFILES}; do \
671539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
681539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
691539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
701539Srgrimes	done
712367Sbde	@${ECHO} installing ${MFILES}
721539Srgrimes	@-for i in ${MFILES}; do \
731539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
741539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
751539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
761539Srgrimes	done
771539Srgrimes
781539Srgrimescopies:
791570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
801570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
812367Sbde		${ECHO} ${SHARED} $$i;					\
821570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
831570Srgrimes		cd ../sys;						\
841570Srgrimes		tar cf - $$i/*.h |					\
851570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
861570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
871570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
881570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
891539Srgrimes	done
901570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
911539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
921570Srgrimes	cd ../sys/${MACHINE}/include && \
931570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
941570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
951570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
961570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
971539Srgrimes
981539Srgrimessymlinks:
991570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
1002367Sbde		${ECHO} ${SHARED} $$i;					\
1011570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
1021570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
1031570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1041539Srgrimes	done
1051570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1061570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1071539Srgrimes
1081539Srgrimes.include <bsd.prog.mk>
109