Makefile revision 10760
12061Sjkh#
210760Sache#	$Id: Makefile,v 1.59 1995/08/30 17:27:57 davidg Exp $
32061Sjkh#
42061Sjkh# Make command line options:
58854Srgrimes#	-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
83197Scsgr#	-DMAKE_EBONES to build eBones (KerberosIV)
93197Scsgr#
102061Sjkh#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
112160Scsgr#	-DNOCRYPT will prevent building of crypt versions
122834Swollman#	-DNOLKM do not build loadable kernel modules
132061Sjkh#	-DNOOBJDIR do not run ``${MAKE} obj''
142061Sjkh#	-DNOPROFILE do not build profiled libraries
152160Scsgr#	-DNOSECURE do not go into secure subdir
161594Srgrimes
172061Sjkh# Put initial settings here.
182061SjkhSUBDIR=
191594Srgrimes
207407Srgrimes# We must do include and lib first so that the perl *.ph generation
217407Srgrimes# works correctly as it uses the header files installed by this.
227108Sphk.if exists(include)
237108SphkSUBDIR+= include
247108Sphk.endif
257407Srgrimes.if exists(lib)
267407SrgrimesSUBDIR+= lib
277407Srgrimes.endif
287108Sphk
292061Sjkh.if exists(bin)
302061SjkhSUBDIR+= bin
312061Sjkh.endif
322061Sjkh.if exists(contrib)
332061SjkhSUBDIR+= contrib
342061Sjkh.endif
352061Sjkh.if exists(games)
362061SjkhSUBDIR+= games
372061Sjkh.endif
382061Sjkh.if exists(gnu)
392061SjkhSUBDIR+= gnu
402061Sjkh.endif
413197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
422626ScsgrSUBDIR+= eBones
432626Scsgr.endif
442061Sjkh.if exists(libexec)
452061SjkhSUBDIR+= libexec
462061Sjkh.endif
472061Sjkh.if exists(sbin)
482061SjkhSUBDIR+= sbin
492061Sjkh.endif
502061Sjkh.if exists(share)
512061SjkhSUBDIR+= share
522061Sjkh.endif
532061Sjkh.if exists(sys)
542061SjkhSUBDIR+= sys
552061Sjkh.endif
562061Sjkh.if exists(usr.bin)
572061SjkhSUBDIR+= usr.bin
582061Sjkh.endif
592061Sjkh.if exists(usr.sbin)
602061SjkhSUBDIR+= usr.sbin
612061Sjkh.endif
622834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
632834SwollmanSUBDIR+= secure
642834Swollman.endif
652834Swollman.if exists(lkm) && !defined(NOLKM)
662834SwollmanSUBDIR+= lkm
672834Swollman.endif
681594Srgrimes
694486Sphk# etc must be last for "distribute" to work
704486Sphk.if exists(etc) && make(distribute)
714486SphkSUBDIR+= etc
724486Sphk.endif
734486Sphk
742061Sjkh# These are last, since it is nice to at least get the base system
752061Sjkh# rebuilt before you do them.
762061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
772061SjkhSUBDIR+= local
782061Sjkh.endif
792061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
802061SjkhSUBDIR+= ports
812061Sjkh.endif
822061Sjkh
832061Sjkh# Handle the -DNOOBJDIR and -DNOCLEANDIR
842061Sjkh.if defined(NOOBJDIR)
852061SjkhOBJDIR=
862061Sjkh.else
872061SjkhOBJDIR=		obj
882061Sjkh.endif
892061Sjkh.if defined(NOCLEANDIR)
902061SjkhCLEANDIR=	clean
918854Srgrimes.else
922061SjkhCLEANDIR=	cleandir
932061Sjkh.endif
942061Sjkh
955511Sjkhworld:	hierarchy mk cleandist includes lib-tools libraries tools
962061Sjkh	@echo "--------------------------------------------------------------"
972061Sjkh	@echo " Rebuilding ${DESTDIR} The whole thing"
982061Sjkh	@echo "--------------------------------------------------------------"
992061Sjkh	@echo
1002061Sjkh	${MAKE} depend all install
1012061Sjkh	cd ${.CURDIR}/share/man &&		${MAKE} makedb
1022061Sjkh
1033030Srgrimeshierarchy:
1042061Sjkh	@echo "--------------------------------------------------------------"
1053030Srgrimes	@echo " Making hierarchy"
1062061Sjkh	@echo "--------------------------------------------------------------"
1076722Sphk	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
1082061Sjkh
1092302Spaulupdate:
1102302Spaul.if defined(SUP_UPDATE)
1112302Spaul	@echo "--------------------------------------------------------------"
1122302Spaul	@echo "Running sup"
1132302Spaul	@echo "--------------------------------------------------------------"
1142302Spaul	@sup -v ${SUPFILE}
11510760Sache.if defined(SUPFILE1)
11610760Sache	@sup -v ${SUPFILE1}
1172302Spaul.endif
11810760Sache.if defined(SUPFILE2)
11910760Sache	@sup -v ${SUPFILE2}
12010760Sache.endif
12110760Sache.endif
1222302Spaul.if defined(CVS_UPDATE)
1232302Spaul	@echo "--------------------------------------------------------------"
1242302Spaul	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
1252302Spaul	@echo "--------------------------------------------------------------"
1262302Spaul	cd ${.CURDIR} &&  cvs update -P -d
1272302Spaul.endif
1282302Spaul
1292061Sjkhcleandist:
1302061Sjkh.if !defined(NOCLEANDIR)
1312061Sjkh	@echo "--------------------------------------------------------------"
1322061Sjkh	@echo " Cleaning up the source tree, and rebuilding the obj tree"
1332061Sjkh	@echo "--------------------------------------------------------------"
1342061Sjkh	@echo
1352061Sjkh	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
1362061Sjkh	if test -d /usr/obj -a ! -d $$dest; then \
1372061Sjkh		mkdir -p $$dest; \
1382061Sjkh	else \
1392061Sjkh		true; \
1402061Sjkh	fi; \
1412061Sjkh	cd $$dest && rm -rf ${SUBDIR}
1422061Sjkh	find . -name obj | xargs rm -rf
1432061Sjkh.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
1442061Sjkh	# The cd is done as local may well be a symbolic link
1452061Sjkh	-cd local && find . -name obj | xargs rm -rf
1462061Sjkh.endif
1472061Sjkh.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
1482061Sjkh	# The cd is done as local may well be a symbolic link
1492061Sjkh	-cd ports && find . -name obj | xargs rm -rf
1502061Sjkh.endif
1512061Sjkh	${MAKE} cleandir
1522061Sjkh	${MAKE} obj
1532061Sjkh.endif
1542061Sjkh
1553626Swollmaninstallmost:
1563626Swollman	@echo "--------------------------------------------------------------"
1573626Swollman	@echo " Installing programs only"
1583626Swollman	@echo "--------------------------------------------------------------"
1593626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
1603626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
1613626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
1623626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
1633626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
1643626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
1653626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
1667059Sroberto	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} install
1673626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1683626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
1693626Swollman#.endif
1703626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1713626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
1723626Swollman#.endif
1733626Swollman
1743626Swollmanmost:
1753626Swollman	@echo "--------------------------------------------------------------"
1763626Swollman	@echo " Building programs only"
1773626Swollman	@echo "--------------------------------------------------------------"
1783626Swollman	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
1793626Swollman	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
1803626Swollman	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
1813626Swollman	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
1823626Swollman	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
1833626Swollman	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
1843626Swollman	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
1857446Ssos	cd ${.CURDIR}/gnu/usr.sbin &&	${MAKE} ${.MAKEFLAGS} all
1863626Swollman#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
1873626Swollman#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
1883626Swollman#.endif
1893626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT)
1903626Swollman#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
1913626Swollman#.endif
1923626Swollman
1932061Sjkhmk:
1942061Sjkh	@echo "--------------------------------------------------------------"
1952061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
1962061Sjkh	@echo "--------------------------------------------------------------"
1972061Sjkh	cd ${.CURDIR}/share/mk &&		${MAKE} install
1982061Sjkh
1992061Sjkhincludes:
2002061Sjkh	@echo "--------------------------------------------------------------"
2012061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/include"
2022061Sjkh	@echo "--------------------------------------------------------------"
2032061Sjkh	@echo
2042061Sjkh.if defined(CLOBBER)
2057130Srgrimes	rm -rf ${DESTDIR}/usr/include/*
2067130Srgrimes	mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
2077130Srgrimes		-p ${DESTDIR}/usr/include
2082061Sjkh.endif
2092061Sjkh	cd ${.CURDIR}/include &&		${MAKE} install
2104249Sache	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
2112685Srgrimes	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
2126927Snate	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
2132685Srgrimes	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
2143518Sache	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
2153197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2163197Scsgr	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
2173197Scsgr.endif
2182061Sjkh	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
2192061Sjkh	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
2202061Sjkh	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
2212883Sphk	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
2223429Sache	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
2233429Sache	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
2247281Srgrimes.if !defined(WANT_CSRG_LIBM)
2253242Spaul	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
2263242Spaul.endif
2277171Sats	cd ${.CURDIR}/lib/libpcap &&		${MAKE} beforeinstall
2282061Sjkh	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
2293213Spst	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
2304942Sache	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
2315749Swollman	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
2325772Swollman	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
2335865Sache	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
2345866Sache	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
2352061Sjkh
2365366Snatelib-tools:
2375366Snate	@echo "--------------------------------------------------------------"
2386934Sse	@echo " Rebuilding tools needed to build the libraries"
2395366Snate	@echo "--------------------------------------------------------------"
2405366Snate	@echo
2417292Srgrimes	cd ${.CURDIR}/gnu/usr.bin/ld && \
2427292Srgrimes		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2435366Snate	cd ${.CURDIR}/usr.bin/ar && \
2445366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2455366Snate	cd ${.CURDIR}/usr.bin/ranlib && \
2465366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2475366Snate	cd ${.CURDIR}/usr.bin/nm && \
2485366Snate		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2495772Swollman	cd ${.CURDIR}/usr.bin/lex/lib && \
2505772Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2515728Swollman	cd ${.CURDIR}/usr.bin/compile_et && \
2525728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
2535728Swollman		rm -f /usr/sbin/compile_et
2545728Swollman	cd ${.CURDIR}/usr.bin/mk_cmds && \
2555728Swollman		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2565366Snate
2572061Sjkhlibraries:
2582061Sjkh	@echo "--------------------------------------------------------------"
2592061Sjkh	@echo " Rebuilding ${DESTDIR}/usr/lib"
2602061Sjkh	@echo "--------------------------------------------------------------"
2612061Sjkh	@echo
2622061Sjkh.if defined(CLOBBER)
2632061Sjkh	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
2642061Sjkh		xargs rm -rf
2652061Sjkh.endif
2668295Srgrimes.if exists(lib/libcompat)
2678295Srgrimes	cd ${.CURDIR}/lib/libcompat && \
2688295Srgrimes		${MAKE} depend all install
2698295Srgrimes.endif
2708489Srgrimes.if exists(lib/libncurses)
2718489Srgrimes	cd ${.CURDIR}/lib/libncurses && \
2728489Srgrimes		${MAKE} depend all install
2738489Srgrimes.endif
2748489Srgrimes.if exists(lib/libtermcap)
2758489Srgrimes	cd ${.CURDIR}/lib/libtermcap && \
2768489Srgrimes		${MAKE} depend all install
2778489Srgrimes.endif
2788295Srgrimes.if exists(gnu)
2792468Spaul	cd ${.CURDIR}/gnu/lib && \
2802061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2812273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
2822061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2838295Srgrimes.endif
2842160Scsgr.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
2852160Scsgr	cd ${.CURDIR}/secure/lib && \
2862160Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2872160Scsgr.endif
2882279Spaul.if exists(lib)
2894054Spst	cd ${.CURDIR}/lib/csu/i386 && \
2904054Spst		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2912061Sjkh	cd ${.CURDIR}/lib && \
2922061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2932279Spaul.endif
2942468Spaul	cd ${.CURDIR}/usr.bin/lex/lib && \
2952468Spaul		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2963197Scsgr.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
2972626Scsgr	cd ${.CURDIR}/eBones/des && \
2982626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
2992626Scsgr	cd ${.CURDIR}/eBones/acl && \
3002626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3012626Scsgr	cd ${.CURDIR}/eBones/kdb && \
3022626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3032626Scsgr	cd ${.CURDIR}/eBones/krb && \
3042626Scsgr		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3052626Scsgr.endif
3068304Srgrimes.if exists(usr.sbin/pcvt/keycap)
3078304Srgrimes	cd ${.CURDIR}/usr.sbin/pcvt/keycap && \
3088304Srgrimes		 ${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3098304Srgrimes.endif
3102061Sjkh
3112061Sjkhtools:
3122061Sjkh	@echo "--------------------------------------------------------------"
31310479Sdg	@echo " Rebuilding ${DESTDIR} C compiler, make, and zic(8)"
3142061Sjkh	@echo "--------------------------------------------------------------"
3152061Sjkh	@echo
3162273Spaul	cd ${.CURDIR}/gnu/usr.bin/cc && \
3172061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3182061Sjkh	cd ${.CURDIR}/usr.bin/make && \
3192061Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
32010479Sdg	cd ${.CURDIR}/usr.sbin/zic && \
32110479Sdg		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
3222061Sjkh
3231594Srgrimes.include <bsd.subdir.mk>
324