Makefile revision 2468
12061Sjkh#
22468Spaul#	$Id: Makefile,v 1.14 1994/08/26 20:44:12 paul Exp $
32061Sjkh#
42061Sjkh# Make command line options:
52061Sjkh#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
62061Sjkh#	-DMAKE_LOCAL to add ./local to the SUBDIR list
72061Sjkh#	-DMAKE_PORTS to add ./ports to the SUBDIR list
82061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
92160Scsgr#	-DNOCRYPT will prevent building of crypt versions
102160Scsgr# XXX2	-DNOKERBEROS do not build Kerberos
112061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
122061Sjkh#	-DNOPROFILE do not build profiled libraries
132160Scsgr#	-DNOSECURE do not go into secure subdir
142061Sjkh#
152160Scsgr# XXX2	Mandatory, and Kerberos will not build sucessfully yet
161594Srgrimes
172061Sjkh# Put initial settings here.
182160ScsgrNOKERBEROS=	yes
192061SjkhSUBDIR=
201594Srgrimes
212061Sjkh.if exists(bin)
222061SjkhSUBDIR+= bin
232061Sjkh.endif
242061Sjkh.if exists(contrib)
252061SjkhSUBDIR+= contrib
262061Sjkh.endif
272061Sjkh.if exists(etc)
282061SjkhSUBDIR+= etc
292061Sjkh.endif
302061Sjkh.if exists(games)
312061SjkhSUBDIR+= games
322061Sjkh.endif
332061Sjkh.if exists(gnu)
342061SjkhSUBDIR+= gnu
352061Sjkh.endif
362061Sjkh.if exists(include)
372061SjkhSUBDIR+= include
382061Sjkh.endif
392061Sjkh.if exists(lib)
402061SjkhSUBDIR+= lib
412061Sjkh.endif
422160Scsgr.if exists(kerberosIV) && !defined(NOCRYPT) && !defined(NOKERBEROS)
432061SjkhSUBDIR+= kerberosIV
442061Sjkh.endif
452061Sjkh.if exists(libexec)
462061SjkhSUBDIR+= libexec
472061Sjkh.endif
482061Sjkh.if exists(sbin)
492061SjkhSUBDIR+= sbin
502061Sjkh.endif
512160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
522160ScsgrSUBDIR+= secure
532160Scsgr.endif
542061Sjkh.if exists(share)
552061SjkhSUBDIR+= share
562061Sjkh.endif
572061Sjkh.if exists(sys)
582061SjkhSUBDIR+= sys
592061Sjkh.endif
602061Sjkh.if exists(usr.bin)
612061SjkhSUBDIR+= usr.bin
622061Sjkh.endif
632061Sjkh.if exists(usr.sbin)
642061SjkhSUBDIR+= usr.sbin
652061Sjkh.endif
661594Srgrimes
672061Sjkh# These are last, since it is nice to at least get the base system
682061Sjkh# rebuilt before you do them.
692061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
702061SjkhSUBDIR+= local
712061Sjkh.endif
722061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
732061SjkhSUBDIR+= ports
742061Sjkh.endif
752061Sjkh
762061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
772061Sjkh.if defined(NOOBJDIR)
782061SjkhOBJDIR=
792061Sjkh.else
802061SjkhOBJDIR=		obj
812061Sjkh.endif
822061Sjkh.if defined(NOCLEANDIR)
832061SjkhCLEANDIR=	clean
842061Sjkh.else 
852061SjkhCLEANDIR=	cleandir
862061Sjkh.endif
872061Sjkh
882468Spaulworld:	directories cleandist mk includes libraries tools
892061Sjkh	@echo "--------------------------------------------------------------"
902061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
912061Sjkh	@echo "--------------------------------------------------------------"
922061Sjkh	@echo
932061Sjkh	${MAKE} depend all install
942061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
952061Sjkh
962302Spaul
972061Sjkhdirectories:
982061Sjkh	@echo "--------------------------------------------------------------"
992061Sjkh	@echo " Making directories"
1002061Sjkh	@echo "--------------------------------------------------------------"
1012302Spaul	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
1022061Sjkh
1032302Spaulupdate:
1042302Spaul.if defined(SUP_UPDATE)
1052302Spaul	@echo "--------------------------------------------------------------"
1062302Spaul	@echo "Running sup"
1072302Spaul	@echo "--------------------------------------------------------------"
1082302Spaul	@sup -v ${SUPFILE}
1092302Spaul.endif
1102302Spaul.if defined(CVS_UPDATE)
1112302Spaul	@echo "--------------------------------------------------------------"
1122302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1132302Spaul	@echo "--------------------------------------------------------------"
1142302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1152302Spaul.endif
1162302Spaul
1172061Sjkhcleandist:
1182061Sjkh.if !defined(NOCLEANDIR)
1192061Sjkh	@echo "--------------------------------------------------------------"
1202061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1212061Sjkh	@echo "--------------------------------------------------------------"
1222061Sjkh	@echo
1232061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1242061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1252061Sjkh		mkdir -p $$dest; \
1262061Sjkh	else \
1272061Sjkh		true; \
1282061Sjkh	fi; \
1292061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1302061Sjkh	find . -name obj | xargs rm -rf
1312061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1322061Sjkh	# The cd is done as local may well be a symbolic link
1332061Sjkh	-cd local && find . -name obj | xargs rm -rf
1342061Sjkh.endif
1352061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1362061Sjkh	# The cd is done as local may well be a symbolic link
1372061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1382061Sjkh.endif
1392061Sjkh	${MAKE} cleandir
1402061Sjkh	${MAKE} obj
1412061Sjkh.endif
1422061Sjkh
1432061Sjkhmk:
1442061Sjkh	@echo "--------------------------------------------------------------"
1452061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1462061Sjkh	@echo "--------------------------------------------------------------"
1472061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1482061Sjkh
1492061Sjkhincludes:
1502061Sjkh	@echo "--------------------------------------------------------------"
1512061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1522061Sjkh	@echo "--------------------------------------------------------------"
1532061Sjkh	@echo
1542061Sjkh.if defined(CLOBBER)
1552061Sjkh	rm -rf ${DESTDIR}/usr/include
1562061Sjkh	mkdir ${DESTDIR}/usr/include
1572061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
1582061Sjkh	chmod 755 ${DESTDIR}/usr/include
1592061Sjkh.endif
1602061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
1612068Sjkh#XXX	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
1622273Spaul#XXX	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
1632160Scsgr.if !defined(NOCRYPT) && !defined(NOKERBEROS)
1642061Sjkh	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
1652061Sjkh.endif
1662061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
1672061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
1682061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
1692061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
1702061Sjkh
1712061Sjkhlibraries:
1722061Sjkh	@echo "--------------------------------------------------------------"
1732061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
1742061Sjkh	@echo "--------------------------------------------------------------"
1752061Sjkh	@echo
1762061Sjkh.if defined(CLOBBER)
1772061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
1782061Sjkh		xargs rm -rf
1792061Sjkh.endif
1802468Spaul	cd ${.CURDIR}/gnu/lib && \
1812061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1822273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
1832061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1842160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
1852160Scsgr	cd ${.CURDIR}/secure/lib && \
1862160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1872160Scsgr.endif
1882279Spaul.if exists(lib)
1892061Sjkh	cd ${.CURDIR}/lib && \
1902061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1912279Spaul.endif
1922468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
1932468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1942160Scsgr.if !defined(NOCRYPT) && !defined(NOKERBEROS)
1952061Sjkh	cd ${.CURDIR}/kerberosIV/acl && \
1962061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1972061Sjkh	cd ${.CURDIR}/kerberosIV/des && \
1982061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1992061Sjkh	cd ${.CURDIR}/kerberosIV/kdb && \
2002061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2012061Sjkh	cd ${.CURDIR}/kerberosIV/krb && \
2022061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2032061Sjkh.endif
2042061Sjkh
2052061Sjkhtools:
2062061Sjkh	@echo "--------------------------------------------------------------"
2072061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
2082061Sjkh	@echo "--------------------------------------------------------------"
2092061Sjkh	@echo
2102273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
2112061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2122061Sjkh	cd ${.CURDIR}/usr.bin/make && \
2132061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2142061Sjkh
2151594Srgrimes.include <bsd.subdir.mk>
216