Makefile revision 7131
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
27131Srgrimes#	$Id: Makefile,v 1.20 1994/11/15 13:42:18 ache 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#
94019Satsall 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 \
143908Sljo	err.h f2c.h fnmatch.h fstab.h fts.h glob.h grp.h histedit.h kvm.h \
154499Sache	limits.h link.h locale.h malloc.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
253329SbdeMFILES=	float.h floatingpoint.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 \
454044Spst		cmp -s $$i ${DESTDIR}/usr/include/$$i || \
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
534044Spst	@if cmp -s ${OSREL} ${OSREL}.new ; 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 \
674044Spst			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j || \
681539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
691539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
701539Srgrimes		done); \
711539Srgrimes	done
722367Sbde	@${ECHO} installing ${LFILES}
731539Srgrimes	@-for i in ${LFILES}; do \
741539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
751539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
761539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
771539Srgrimes	done
782367Sbde	@${ECHO} installing ${MFILES}
791539Srgrimes	@-for i in ${MFILES}; do \
801539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
811539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
821539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
831539Srgrimes	done
841539Srgrimes
851539Srgrimescopies:
861570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
877131Srgrimes	mkdir ${DESTDIR}/usr/include/${LUDIR}
887131Srgrimes	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/${LUDIR}
891570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
902367Sbde		${ECHO} ${SHARED} $$i;					\
911570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
921570Srgrimes		cd ../sys;						\
931570Srgrimes		tar cf - $$i/*.h |					\
941570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
951570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
961570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
971570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
981539Srgrimes	done
991570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1001539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
1011570Srgrimes	cd ../sys/${MACHINE}/include && \
1021570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
1031570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
1041570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
1051570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
1061539Srgrimes
1071539Srgrimessymlinks:
1081570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
1092367Sbde		${ECHO} ${SHARED} $$i;					\
1101570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
1111570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
1121570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1131539Srgrimes	done
1141570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1151570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1161539Srgrimes
1171539Srgrimes.include <bsd.prog.mk>
118