Makefile revision 3211
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
411917Swollmanbeforeinstall: ${SHARED}
422367Sbde	@${ECHO} installing ${FILES}
431539Srgrimes	@-for i in ${FILES}; do \
441539Srgrimes		cmp -s $$i ${DESTDIR}/usr/include/$$i > /dev/null 2>&1 || \
451539Srgrimes		    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$i \
461539Srgrimes		    ${DESTDIR}/usr/include/$$i; \
471539Srgrimes	done
482367Sbde	@${ECHO} creating osreldate.h
492004Swollman	@rm -f ${DESTDIR}/usr/include/osreldate.h
502004Swollman	@echo \#'undef __FreeBSD_version' > ${DESTDIR}/usr/include/osreldate.h
512004Swollman	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
522004Swollman		>> ${DESTDIR}/usr/include/osreldate.h
532809Sbde	@chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/osreldate.h
542809Sbde	@chmod 444 ${DESTDIR}/usr/include/osreldate.h
552367Sbde	@${ECHO} installing ${DIRS}
561539Srgrimes	@-for i in ${DIRS}; do \
571539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
581539Srgrimes		then \
591539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
601539Srgrimes		fi; \
611539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
621539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
631539Srgrimes		(cd $$i; for j in *.[ih]; do \
641539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
651539Srgrimes			    /dev/null 2>&1 || \
661539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
671539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
681539Srgrimes		done); \
691539Srgrimes	done
702367Sbde	@${ECHO} installing ${LFILES}
711539Srgrimes	@-for i in ${LFILES}; do \
721539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
731539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
741539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
751539Srgrimes	done
762367Sbde	@${ECHO} installing ${MFILES}
771539Srgrimes	@-for i in ${MFILES}; do \
781539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
791539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
801539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
811539Srgrimes	done
821539Srgrimes
831539Srgrimescopies:
841570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
851570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
862367Sbde		${ECHO} ${SHARED} $$i;					\
871570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
881570Srgrimes		cd ../sys;						\
891570Srgrimes		tar cf - $$i/*.h |					\
901570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
911570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
921570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
931570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
941539Srgrimes	done
951570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
961539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
971570Srgrimes	cd ../sys/${MACHINE}/include && \
981570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
991570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
1001570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
1011570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
1021539Srgrimes
1031539Srgrimessymlinks:
1041570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
1052367Sbde		${ECHO} ${SHARED} $$i;					\
1061570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
1071570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
1081570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1091539Srgrimes	done
1101570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1111570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1121539Srgrimes
1131539Srgrimes.include <bsd.prog.mk>
114