Makefile revision 1615
11539Srgrimes#	@(#)Makefile	8.2 (Berkeley) 1/4/94
21539Srgrimes#
31539Srgrimes# Doing a make install builds /usr/include
41539Srgrimes#
51539Srgrimes# The ``rm -rf''s used below are safe because rm doesn't follow symbolic
61539Srgrimes# links.
71539Srgrimes#
81539Srgrimesall clean cleandir depend lint tags:
91539Srgrimes
101604Srgrimes# XXX MISSING:	mp.h
111539SrgrimesFILES=	a.out.h ar.h assert.h bitstring.h ctype.h db.h dirent.h disktab.h \
121615Srgrimes	err.h fnmatch.h fstab.h fts.h glob.h grp.h kvm.h limits.h link.h \
131615Srgrimes	locale.h \
141570Srgrimes	math.h memory.h mpool.h ndbm.h netdb.h nlist.h paths.h pwd.h \
151539Srgrimes	ranlib.h regex.h regexp.h resolv.h rune.h runetype.h setjmp.h \
161539Srgrimes	sgtty.h signal.h stab.h stddef.h stdio.h stdlib.h string.h strings.h \
171539Srgrimes	struct.h sysexits.h tar.h time.h ttyent.h tzfile.h unistd.h utime.h \
181539Srgrimes	utmp.h vis.h
191539Srgrimes
201539SrgrimesMFILES=	float.h frame.h stdarg.h varargs.h
211539SrgrimesLFILES=	errno.h fcntl.h syslog.h termios.h
221539Srgrimes
231570SrgrimesDIRS=	arpa protocols
241570SrgrimesLDIRS=	net netccitt netinet netiso netns nfs sys vm
251570SrgrimesLUDIR=	ufs
261570SrgrimesUDIRS=	ufs/ffs ufs/lfs ufs/mfs ufs/ufs
271539Srgrimes
281539SrgrimesNOOBJ=	noobj
291539Srgrimes
301539Srgrimes# Define SHARED to indicate whether you want symbolic links to the system
311539Srgrimes# source (``symlinks''), or a separate copy (``copies''); (latter useful
321539Srgrimes# in environments where it's not possible to keep /sys publicly readable)
331539Srgrimes# SHARED=	copies
341570SrgrimesSHARED?=	symlinks
351539Srgrimes
361539Srgrimesinstall: ${SHARED}
371539Srgrimes	@echo installing ${FILES}
381539Srgrimes	@-for i in ${FILES}; do \
391539Srgrimes		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
401539Srgrimes		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
411539Srgrimes		    ${DESTDIR}/usr/include/$$i; \
421539Srgrimes	done
431539Srgrimes	@echo installing ${DIRS}
441539Srgrimes	@-for i in ${DIRS}; do \
451539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
461539Srgrimes		then \
471539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
481539Srgrimes		fi; \
491539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
501539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
511539Srgrimes		(cd $$i; for j in *.[ih]; do \
521539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
531539Srgrimes			    /dev/null 2>&1 || \
541539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
551539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
561539Srgrimes		done); \
571539Srgrimes	done
581539Srgrimes	@echo installing ${LFILES}
591539Srgrimes	@-for i in ${LFILES}; do \
601539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
611539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
621539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
631539Srgrimes	done
641539Srgrimes	@echo installing ${MFILES}
651539Srgrimes	@-for i in ${MFILES}; do \
661539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
671539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
681539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
691539Srgrimes	done
701539Srgrimes
711539Srgrimescopies:
721570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
731570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
741570Srgrimes		echo ${SHARED} $$i;					\
751570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
761570Srgrimes		cd ../sys;						\
771570Srgrimes		tar cf - $$i/*.h |					\
781570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
791570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
801570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
811570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
821539Srgrimes	done
831570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
841539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
851570Srgrimes	cd ../sys/${MACHINE}/include && \
861570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
871570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
881570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
891570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
901539Srgrimes
911539Srgrimessymlinks:
921570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
931570Srgrimes		echo ${SHARED} $$i;					\
941570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
951570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
961570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
971539Srgrimes	done
981570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
991570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1001539Srgrimes
1011539Srgrimes.include <bsd.prog.mk>
102