Makefile revision 1917
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
21917Swollman#	$Id: Makefile,v 1.7 1994/08/04 20:49:28 wollman 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 \
151841Swollman	limits.h link.h \
161615Srgrimes	locale.h \
171570Srgrimes	math.h memory.h mpool.h ndbm.h netdb.h nlist.h paths.h pwd.h \
181539Srgrimes	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h \
191539Srgrimes	sgtty.h signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
201539Srgrimes	struct.h sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
211539Srgrimes	utmp.h vis.h
221539Srgrimes
231833SwollmanMFILES=	float.h floatingpoint.h frame.h stdarg.h varargs.h
241539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
251539Srgrimes
261839SwollmanDIRS=	arpa protocols rpc
271570SrgrimesLDIRS=	net netccitt netinet netiso netns nfs sys vm
281570SrgrimesLUDIR=	ufs
291570SrgrimesUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
301539Srgrimes
311539SrgrimesNOOBJ=	noobj
321539Srgrimes
331539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
341539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
351539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
361539Srgrimes# SHARED=	copies
371570SrgrimesSHARED?=	symlinks
381539Srgrimes
391917Swollmanbeforeinstall: ${SHARED}
401539Srgrimes	@echo installing ${FILES}
411539Srgrimes	@-for i in ${FILES}; do \
421539Srgrimes		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
431539Srgrimes		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
441539Srgrimes		    ${DESTDIR}/usr/include/$$i; \
451539Srgrimes	done
461539Srgrimes	@echo installing ${DIRS}
471539Srgrimes	@-for i in ${DIRS}; do \
481539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
491539Srgrimes		then \
501539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
511539Srgrimes		fi; \
521539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
531539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
541539Srgrimes		(cd $$i; for j in *.[ih]; do \
551539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
561539Srgrimes			    /dev/null 2>&1 || \
571539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
581539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
591539Srgrimes		done); \
601539Srgrimes	done
611539Srgrimes	@echo installing ${LFILES}
621539Srgrimes	@-for i in ${LFILES}; do \
631539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
641539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
651539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
661539Srgrimes	done
671539Srgrimes	@echo installing ${MFILES}
681539Srgrimes	@-for i in ${MFILES}; do \
691539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
701539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
711539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
721539Srgrimes	done
731539Srgrimes
741539Srgrimescopies:
751570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
761570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
771570Srgrimes		echo ${SHARED} $$i;					\
781570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
791570Srgrimes		cd ../sys;						\
801570Srgrimes		tar cf - $$i/*.h |					\
811570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
821570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
831570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
841570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
851539Srgrimes	done
861570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
871539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
881570Srgrimes	cd ../sys/${MACHINE}/include && \
891570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
901570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
911570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
921570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
931539Srgrimes
941539Srgrimessymlinks:
951570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
961570Srgrimes		echo ${SHARED} $$i;					\
971570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
981570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
991570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1001539Srgrimes	done
1011570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1021570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1031539Srgrimes
1041539Srgrimes.include <bsd.prog.mk>
105