Makefile revision 2004
11833Swollman#	From: @(#)Makefile	8.2 (Berkeley) 1/4/94
22004Swollman#	$Id: Makefile,v 1.8 1994/08/07 22:29:20 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
462004Swollman	@echo creating osreldate.h
472004Swollman	@rm -f ${DESTDIR}/usr/include/osreldate.h
482004Swollman	@echo \#'undef __FreeBSD_version' > ${DESTDIR}/usr/include/osreldate.h
492004Swollman	@echo \#'define __FreeBSD_version '`sysctl -n kern.osreldate` \
502004Swollman		>> ${DESTDIR}/usr/include/osreldate.h
511539Srgrimes	@echo installing ${DIRS}
521539Srgrimes	@-for i in ${DIRS}; do \
531539Srgrimes		if [ ! -d ${DESTDIR}/usr/include/$$i ]; \
541539Srgrimes		then \
551539Srgrimes			mkdir ${DESTDIR}/usr/include/$$i; \
561539Srgrimes		fi; \
571539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
581539Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i; \
591539Srgrimes		(cd $$i; for j in *.[ih]; do \
601539Srgrimes			cmp -s $$j ${DESTDIR}/usr/include/$$i/$$j > \
611539Srgrimes			    /dev/null 2>&1 || \
621539Srgrimes			    install -c -o ${BINOWN} -g ${BINGRP} -m 444 $$j \
631539Srgrimes			    ${DESTDIR}/usr/include/$$i/$$j; \
641539Srgrimes		done); \
651539Srgrimes	done
661539Srgrimes	@echo installing ${LFILES}
671539Srgrimes	@-for i in ${LFILES}; do \
681539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
691539Srgrimes		ln -s sys/$$i ${DESTDIR}/usr/include/$$i; \
701539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
711539Srgrimes	done
721539Srgrimes	@echo installing ${MFILES}
731539Srgrimes	@-for i in ${MFILES}; do \
741539Srgrimes		rm -f ${DESTDIR}/usr/include/$$i; \
751539Srgrimes		ln -s machine/$$i ${DESTDIR}/usr/include/$$i; \
761539Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i; \
771539Srgrimes	done
781539Srgrimes
791539Srgrimescopies:
801570Srgrimes	rm -rf ${DESTDIR}/usr/include/${LUDIR}
811570Srgrimes	@-for i in ${LDIRS} ${UDIRS}; do				\
821570Srgrimes		echo ${SHARED} $$i;					\
831570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
841570Srgrimes		cd ../sys;						\
851570Srgrimes		tar cf - $$i/*.h |					\
861570Srgrimes			(cd ${DESTDIR}/usr/include; tar xpfB -);	\
871570Srgrimes		chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;\
881570Srgrimes		chmod -R 444 ${DESTDIR}/usr/include/$$i;		\
891570Srgrimes		chmod 755 ${DESTDIR}/usr/include/$$i;			\
901539Srgrimes	done
911570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
921539Srgrimes	mkdir ${DESTDIR}/usr/include/machine
931570Srgrimes	cd ../sys/${MACHINE}/include && \
941570Srgrimes	    tar cf - *.h | (cd ${DESTDIR}/usr/include/machine; tar xpfB -);
951570Srgrimes	chown -R ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/machine;
961570Srgrimes	chmod -R 444 ${DESTDIR}/usr/include/machine;
971570Srgrimes	chmod 755 ${DESTDIR}/usr/include/machine;
981539Srgrimes
991539Srgrimessymlinks:
1001570Srgrimes	@for i in ${LDIRS} ${LUDIR}; do					\
1011570Srgrimes		echo ${SHARED} $$i;					\
1021570Srgrimes		rm -rf ${DESTDIR}/usr/include/$$i;			\
1031570Srgrimes		ln -s /sys/$$i ${DESTDIR}/usr/include/$$i;		\
1041570Srgrimes		chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include/$$i;	\
1051539Srgrimes	done
1061570Srgrimes	rm -rf ${DESTDIR}/usr/include/machine
1071570Srgrimes	ln -s /sys/${MACHINE}/include ${DESTDIR}/usr/include/machine
1081539Srgrimes
1091539Srgrimes.include <bsd.prog.mk>
110