Makefile revision 2061
12061Sjkh#
22061Sjkh#	$Id$
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
92061Sjkh# XXX1	-DNOCRYPT will prevent building of crypt versions (BROKEN RIGHT NOW)
102061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
112061Sjkh#	-DNOPROFILE do not build profiled libraries
122061Sjkh#
132061Sjkh# XXX1	This has not yet been implemented in FreeBSD 2.0.0, the only way
142061Sjkh#	to build the system is with full crypt and KerberosIV
152061Sjkh#
161594Srgrimes
172061Sjkh# Put initial settings here.
182061SjkhNOCRYPT=	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
422061Sjkh.if exists(kerberosIV) && !defined(NOCRYPT)
432061SjkhSUBDIR+= kerberosIV
442061Sjkh.endif
452061Sjkh.if exists(libexec)
462061SjkhSUBDIR+= libexec
472061Sjkh.endif
482061Sjkh.if exists(sbin)
492061SjkhSUBDIR+= sbin
502061Sjkh.endif
512061Sjkh.if exists(share)
522061SjkhSUBDIR+= share
532061Sjkh.endif
542061Sjkh.if exists(sys)
552061SjkhSUBDIR+= sys
562061Sjkh.endif
572061Sjkh.if exists(usr.bin)
582061SjkhSUBDIR+= usr.bin
592061Sjkh.endif
602061Sjkh.if exists(usr.sbin)
612061SjkhSUBDIR+= usr.sbin
622061Sjkh.endif
631594Srgrimes
642061Sjkh# These are last, since it is nice to at least get the base system
652061Sjkh# rebuilt before you do them.
662061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
672061SjkhSUBDIR+= local
682061Sjkh.endif
692061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
702061SjkhSUBDIR+= ports
712061Sjkh.endif
722061Sjkh
732061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
742061Sjkh.if defined(NOOBJDIR)
752061SjkhOBJDIR=
762061Sjkh.else
772061SjkhOBJDIR=		obj
782061Sjkh.endif
792061Sjkh.if defined(NOCLEANDIR)
802061SjkhCLEANDIR=	clean
812061Sjkh.else 
822061SjkhCLEANDIR=	cleandir
832061Sjkh.endif
842061Sjkh
852061Sjkhworld:	directories cleandist mk includes libraries tools mdec
862061Sjkh	@echo "--------------------------------------------------------------"
872061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
882061Sjkh	@echo "--------------------------------------------------------------"
892061Sjkh	@echo
902061Sjkh	${MAKE} depend all install
912061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
922061Sjkh
932061Sjkhdirectories:
942061Sjkh	@echo "--------------------------------------------------------------"
952061Sjkh	@echo " Making directories"
962061Sjkh	@echo "--------------------------------------------------------------"
972061Sjkh	@echo " XXX Not yet ready in 2.0.0"
982061Sjkh# XXX	cd ${.CURDIR}/etc &&			${MAKE} distrib-dirs
992061Sjkh
1002061Sjkhcleandist:
1012061Sjkh.if !defined(NOCLEANDIR)
1022061Sjkh	@echo "--------------------------------------------------------------"
1032061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1042061Sjkh	@echo "--------------------------------------------------------------"
1052061Sjkh	@echo
1062061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1072061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1082061Sjkh		mkdir -p $$dest; \
1092061Sjkh	else \
1102061Sjkh		true; \
1112061Sjkh	fi; \
1122061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1132061Sjkh	find . -name obj | xargs rm -rf
1142061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1152061Sjkh	# The cd is done as local may well be a symbolic link
1162061Sjkh	-cd local && find . -name obj | xargs rm -rf
1172061Sjkh.endif
1182061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1192061Sjkh	# The cd is done as local may well be a symbolic link
1202061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1212061Sjkh.endif
1222061Sjkh	${MAKE} cleandir
1232061Sjkh	${MAKE} obj
1242061Sjkh.endif
1252061Sjkh
1262061Sjkhmk:
1272061Sjkh	@echo "--------------------------------------------------------------"
1282061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1292061Sjkh	@echo "--------------------------------------------------------------"
1302061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1312061Sjkh
1322061Sjkhincludes:
1332061Sjkh	@echo "--------------------------------------------------------------"
1342061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
1352061Sjkh	@echo "--------------------------------------------------------------"
1362061Sjkh	@echo
1372061Sjkh.if defined(CLOBBER)
1382061Sjkh	rm -rf ${DESTDIR}/usr/include
1392061Sjkh	mkdir ${DESTDIR}/usr/include
1402061Sjkh	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
1412061Sjkh	chmod 755 ${DESTDIR}/usr/include
1422061Sjkh.endif
1432061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
1442061Sjkh	cd ${.CURDIR}/gnu/lib/libg++ &&		${MAKE} beforeinstall
1452061Sjkh	cd ${.CURDIR}/gnu/usr.bin/cc/libobjc &&	${MAKE} beforeinstall
1462061Sjkh.if !defined(NOCRYPT)
1472061Sjkh	cd ${.CURDIR}/kerberosIV/include &&	${MAKE} install
1482061Sjkh.endif
1492061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
1502061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
1512061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
1522061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
1532061Sjkh
1542061Sjkhlibraries:
1552061Sjkh	@echo "--------------------------------------------------------------"
1562061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
1572061Sjkh	@echo "--------------------------------------------------------------"
1582061Sjkh	@echo
1592061Sjkh.if defined(CLOBBER)
1602061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
1612061Sjkh		xargs rm -rf
1622061Sjkh.endif
1632061Sjkh	# XXX The whole GNU block should be doable in one command, as soon		# as libg++ works on FreeBSD 2.0 I will try that out
1642061Sjkh#XXX	cd ${.CURDIR}/gnu/lib/libg++ && \
1652061Sjkh#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1662061Sjkh	cd ${.CURDIR}/gnu/lib/libmalloc && \
1672061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1682061Sjkh	cd ${.CURDIR}/gnu/lib/libreadline && \
1692061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1702061Sjkh	cd ${.CURDIR}/gnu/lib/libregex && \
1712061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1722061Sjkh	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
1732061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1742061Sjkh	cd ${.CURDIR}/lib && \
1752061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1762061Sjkh	# You need the lex lib before you can build kerberosIV
1772061Sjkh#XXX	# We don't have lex in the 2.0 tree yet!
1782061Sjkh#XXX	cd ${.CURDIR}/usr.bin/lex/lib && \
1792061Sjkh#XXX		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1802061Sjkh.if !defined(NOCRYPT)
1812061Sjkh	cd ${.CURDIR}/kerberosIV/acl && \
1822061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1832061Sjkh	cd ${.CURDIR}/kerberosIV/des && \
1842061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1852061Sjkh	cd ${.CURDIR}/kerberosIV/kdb && \
1862061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1872061Sjkh	cd ${.CURDIR}/kerberosIV/krb && \
1882061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1892061Sjkh.endif
1902061Sjkh
1912061Sjkhtools:
1922061Sjkh	@echo "--------------------------------------------------------------"
1932061Sjkh	@echo " Rebuilding ${DESTDIR} Compiler and Make"
1942061Sjkh	@echo "--------------------------------------------------------------"
1952061Sjkh	@echo
1962061Sjkh	cd ${.CURDIR}/gnu/usr.bin/cc && \
1972061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
1982061Sjkh	cd ${.CURDIR}/usr.bin/make && \
1992061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2002061Sjkh
2012061Sjkhmdec:
2022061Sjkh	@echo "--------------------------------------------------------------"
2032061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/mdec"
2042061Sjkh	@echo "--------------------------------------------------------------"
2052061Sjkh	@echo
2062061Sjkh	@echo " XXX Not yet ready in 2.0.0"
2072061Sjkh#XXX.if ${MACHINE} == "i386"
2082061Sjkh#XXX	# XXX Need to fix for obj case, src/sys/Makefile needs to be fixed to
2092061Sjkh#XXX	# traverse down into here and this can go away!
2102061Sjkh#XXX	cd ${.CURDIR}/sys/i386/boot &&	${MAKE} depend all install ${CLEANDIR}
2112061Sjkh#XXX.if defined (DESTDIR)
2122061Sjkh#XXX	# XXX Really need to fix the sys/i386/boot Makefile so this is not
2132061Sjkh#XXX	# necessary!!!
2142061Sjkh#XXX	cd /usr/mdec && find . | cpio -pdamuv ${DESTDIR}/usr/mdec
2152061Sjkh#XXX.endif
2162061Sjkh#XXX.endif
2172061Sjkh
2181594Srgrimes.include <bsd.subdir.mk>
219