Makefile revision 6934
159769Sgrog#
259769Sgrog#	$Id: Makefile,v 1.42 1995/03/06 05:52:47 nate Exp $
324424Swosch#
424424Swosch# Make command line options:
524424Swosch#	-DCLOBBER will remove /usr/include and MOST of /usr/lib 
624424Swosch#	-DMAKE_LOCAL to add ./local to the SUBDIR list
724424Swosch#	-DMAKE_PORTS to add ./ports to the SUBDIR list
824424Swosch#	-DMAKE_EBONES to build eBones (KerberosIV)
924424Swosch#
1024424Swosch#	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
1124424Swosch#	-DNOCRYPT will prevent building of crypt versions
1224424Swosch#	-DNOLKM do not build loadable kernel modules
1324424Swosch#	-DNOOBJDIR do not run ``${MAKE} obj''
1424424Swosch#	-DNOPROFILE do not build profiled libraries
1542704Swosch#	-DNOSECURE do not go into secure subdir
1642704Swosch
1742704Swosch# Put initial settings here.
1824424SwoschSUBDIR=
1942704Swosch
2042704Swosch.if exists(bin)
2142704SwoschSUBDIR+= bin
2242704Swosch.endif
2342704Swosch.if exists(contrib)
2442704SwoschSUBDIR+= contrib
2542704Swosch.endif
2642704Swosch.if exists(games)
2742704SwoschSUBDIR+= games
2842704Swosch.endif
2942704Swosch.if exists(gnu)
3059769SgrogSUBDIR+= gnu
3159769Sgrog.endif
3259769Sgrog.if exists(include)
3359769SgrogSUBDIR+= include
3459769Sgrog.endif
3559769Sgrog.if exists(lib)
3659769SgrogSUBDIR+= lib
3759769Sgrog.endif
3859769Sgrog.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
3924424SwoschSUBDIR+= eBones
4042704Swosch.endif
4124424Swosch.if exists(libexec)
4242704SwoschSUBDIR+= libexec
4324424Swosch.endif
4442704Swosch.if exists(sbin)
4524424SwoschSUBDIR+= sbin
4624424Swosch.endif
4724424Swosch.if exists(share)
4842704SwoschSUBDIR+= share
4925031Swosch.endif
5059156Swosch.if exists(sys)
5125031SwoschSUBDIR+= sys
5225031Swosch.endif
5324424Swosch.if exists(usr.bin)
5424424SwoschSUBDIR+= usr.bin
5524424Swosch.endif
5624424Swosch.if exists(usr.sbin)
5771231SitojunSUBDIR+= usr.sbin
5824424Swosch.endif
5971231Sitojun.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
6025031SwoschSUBDIR+= secure
6171231Sitojun.endif
6224424Swosch.if exists(lkm) && !defined(NOLKM)
6325031SwoschSUBDIR+= lkm
6425031Swosch.endif
6571231Sitojun
6625031Swosch# etc must be last for "distribute" to work
6771231Sitojun.if exists(etc) && make(distribute)
6870110SwoschSUBDIR+= etc
6970110Swosch.endif
7070110Swosch
7170110Swosch# These are last, since it is nice to at least get the base system
7270110Swosch# rebuilt before you do them.
7370110Swosch.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
7470110SwoschSUBDIR+= local
7570110Swosch.endif
7670110Swosch.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
7770110SwoschSUBDIR+= ports
7870110Swosch.endif
7980675Sasmodai
8080675Sasmodai# Handle the -DNOOBJDIR and -DNOCLEANDIR
8180675Sasmodai.if defined(NOOBJDIR)
8280675SasmodaiOBJDIR=
8380675Sasmodai.else
8480675SasmodaiOBJDIR=		obj
8580675Sasmodai.endif
8680675Sasmodai.if defined(NOCLEANDIR)
8780675SasmodaiCLEANDIR=	clean
8880675Sasmodai.else 
8980675SasmodaiCLEANDIR=	cleandir
9080675Sasmodai.endif
9180675Sasmodai
9280675Sasmodaiworld:	hierarchy mk cleandist includes lib-tools libraries tools
9380675Sasmodai	@echo "--------------------------------------------------------------"
9480675Sasmodai	@echo " Rebuilding ${DESTDIR} The whole thing"
9580675Sasmodai	@echo "--------------------------------------------------------------"
9680675Sasmodai	@echo
9780675Sasmodai	${MAKE} depend all install
9880675Sasmodai	cd ${.CURDIR}/share/man &&		${MAKE} makedb
9980675Sasmodai
10080675Sasmodaihierarchy:
10180675Sasmodai	@echo "--------------------------------------------------------------"
10280675Sasmodai	@echo " Making hierarchy"
10380675Sasmodai	@echo "--------------------------------------------------------------"
10480675Sasmodai	cd ${.CURDIR}/etc &&		${MAKE} distrib-dirs
10580675Sasmodai
10680675Sasmodaiupdate:
10780675Sasmodai.if defined(SUP_UPDATE)
10880675Sasmodai	@echo "--------------------------------------------------------------"
10980675Sasmodai	@echo "Running sup"
11080675Sasmodai	@echo "--------------------------------------------------------------"
11180675Sasmodai	@sup -v ${SUPFILE}
11280675Sasmodai.endif
11380675Sasmodai.if defined(CVS_UPDATE)
11480675Sasmodai	@echo "--------------------------------------------------------------"
11580675Sasmodai	@echo "Updating /usr/src from cvs repository" ${CVSROOT}
11680675Sasmodai	@echo "--------------------------------------------------------------"
11780675Sasmodai	cd ${.CURDIR} &&  cvs update -P -d
11880675Sasmodai.endif
11980675Sasmodai
12080675Sasmodaicleandist:
12180675Sasmodai.if !defined(NOCLEANDIR)
12280675Sasmodai	@echo "--------------------------------------------------------------"
12380675Sasmodai	@echo " Cleaning up the source tree, and rebuilding the obj tree"
12480675Sasmodai	@echo "--------------------------------------------------------------"
12580675Sasmodai	@echo
12680675Sasmodai	here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
12780675Sasmodai	if test -d /usr/obj -a ! -d $$dest; then \
12880675Sasmodai		mkdir -p $$dest; \
12980675Sasmodai	else \
13080675Sasmodai		true; \
13180675Sasmodai	fi; \
13280675Sasmodai	cd $$dest && rm -rf ${SUBDIR}
13380675Sasmodai	find . -name obj | xargs rm -rf
13480675Sasmodai.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
13580675Sasmodai	# The cd is done as local may well be a symbolic link
13680675Sasmodai	-cd local && find . -name obj | xargs rm -rf
13780675Sasmodai.endif
138101401Swosch.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
13980675Sasmodai	# The cd is done as local may well be a symbolic link
14087200Swosch	-cd ports && find . -name obj | xargs rm -rf
14187200Swosch.endif
14287200Swosch	${MAKE} cleandir
14380675Sasmodai	${MAKE} obj
144104772Smaxim.endif
145104772Smaxim
146104772Smaximinstallmost:
147104772Smaxim	@echo "--------------------------------------------------------------"
148104781Sjhb	@echo " Installing programs only"
149104781Sjhb	@echo "--------------------------------------------------------------"
150104781Sjhb	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} install
151104781Sjhb	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} install
152104781Sjhb	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} install
153104781Sjhb	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} install
154104781Sjhb	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} install
155113054Smurray	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} install
156113054Smurray	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} install
157113054Smurray#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
158114211Swosch#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} installmost
159114211Swosch#.endif
160114211Swosch#.if !defined(NOSECURE) && !defined(NOCRYPT)
161114211Swosch#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} installmost
162114211Swosch#.endif
163111949Swosch
164111949Swoschmost:
16580675Sasmodai	@echo "--------------------------------------------------------------"
16680675Sasmodai	@echo " Building programs only"
167104781Sjhb	@echo "--------------------------------------------------------------"
16824424Swosch	cd ${.CURDIR}/bin	&&	${MAKE} ${.MAKEFLAGS} all
16924424Swosch	cd ${.CURDIR}/sbin	&&	${MAKE} ${.MAKEFLAGS} all
17024424Swosch	cd ${.CURDIR}/libexec	&&	${MAKE} ${.MAKEFLAGS} all
17124424Swosch	cd ${.CURDIR}/usr.bin	&&	${MAKE} ${.MAKEFLAGS} all
17269277Sasmodai	cd ${.CURDIR}/usr.sbin	&&	${MAKE} ${.MAKEFLAGS} all
17369277Sasmodai	cd ${.CURDIR}/gnu/libexec &&	${MAKE} ${.MAKEFLAGS} all
17424424Swosch	cd ${.CURDIR}/gnu/usr.bin &&	${MAKE} ${.MAKEFLAGS} all
17525031Swosch#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
17625031Swosch#	cd ${.CURDIR}/eBones	&&	${MAKE} ${.MAKEFLAGS} most
17725031Swosch#.endif
17880675Sasmodai#.if !defined(NOSECURE) && !defined(NOCRYPT)
179104782Sjhb#	cd ${.CURDIR}/secure	&&	${MAKE} ${.MAKEFLAGS} most
18025031Swosch#.endif
181104782Sjhb
182104782Sjhbmk:
183104782Sjhb	@echo "--------------------------------------------------------------"
184104797Sjhb	@echo " Rebuilding ${DESTDIR}/usr/share/mk"
185104797Sjhb	@echo "--------------------------------------------------------------"
18625031Swosch	cd ${.CURDIR}/share/mk &&		${MAKE} install
18725031Swosch
18825031Swoschincludes:
18945349Swosch	@echo "--------------------------------------------------------------"
19045349Swosch	@echo " Rebuilding ${DESTDIR}/usr/include"
191104782Sjhb	@echo "--------------------------------------------------------------"
192104782Sjhb	@echo
193104782Sjhb.if defined(CLOBBER)
194104782Sjhb	rm -rf ${DESTDIR}/usr/include
19542704Swosch	mkdir ${DESTDIR}/usr/include
19625031Swosch	chown ${BINOWN}.${BINGRP} ${DESTDIR}/usr/include
19724424Swosch	chmod 755 ${DESTDIR}/usr/include
19859769Sgrog.endif
19925031Swosch	cd ${.CURDIR}/include &&		${MAKE} install
20025031Swosch	cd ${.CURDIR}/gnu/include &&		${MAKE}	install
20125031Swosch	cd ${.CURDIR}/gnu/lib/libreadline &&	${MAKE} beforeinstall
20225031Swosch	cd ${.CURDIR}/gnu/lib/libregex &&	${MAKE} beforeinstall
20359769Sgrog	cd ${.CURDIR}/gnu/lib/libg++ &&         ${MAKE} beforeinstall
20425031Swosch	cd ${.CURDIR}/gnu/lib/libdialog &&      ${MAKE} beforeinstall
20525031Swosch.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
20625031Swosch	cd ${.CURDIR}/eBones/include &&		${MAKE} beforeinstall
20725031Swosch.endif
20824424Swosch	cd ${.CURDIR}/lib/libc &&		${MAKE} beforeinstall
20925031Swosch	cd ${.CURDIR}/lib/libcurses &&		${MAKE} beforeinstall
21025031Swosch	cd ${.CURDIR}/lib/libedit &&		${MAKE} beforeinstall
21125031Swosch	cd ${.CURDIR}/lib/libmd &&		${MAKE} beforeinstall
21225031Swosch	cd ${.CURDIR}/lib/libmytinfo &&		${MAKE}	beforeinstall
21325031Swosch	cd ${.CURDIR}/lib/libncurses &&		${MAKE}	beforeinstall
21459769Sgrog.if defined(WANT_MSUN)
21559769Sgrog	cd ${.CURDIR}/lib/msun &&		${MAKE} beforeinstall
21642704Swosch.endif
21742704Swosch	cd ${.CURDIR}/lib/librpcsvc &&		${MAKE} beforeinstall
21842704Swosch	cd ${.CURDIR}/lib/libskey &&		${MAKE} beforeinstall
21970110Swosch	cd ${.CURDIR}/lib/libtermcap &&		${MAKE}	beforeinstall
22042704Swosch	cd ${.CURDIR}/lib/libcom_err &&		${MAKE} beforeinstall
22142704Swosch	cd ${.CURDIR}/lib/libss &&		${MAKE} beforeinstall
22225031Swosch	cd ${.CURDIR}/lib/libforms &&		${MAKE}	beforeinstall
22325031Swosch	cd ${.CURDIR}/lib/libscsi &&		${MAKE}	beforeinstall
22424424Swosch
22525031Swoschlib-tools:
22625031Swosch	@echo "--------------------------------------------------------------"
22725031Swosch	@echo " Rebuilding tools needed to build the libraries"
22825031Swosch	@echo "--------------------------------------------------------------"
22925031Swosch	@echo
23025031Swosch	cd ${.CURDIR}/usr.bin/ar && \
23125031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23225031Swosch	cd ${.CURDIR}/usr.bin/ranlib && \
23325031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23424424Swosch	cd ${.CURDIR}/usr.bin/nm && \
23525031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23625031Swosch	cd ${.CURDIR}/usr.bin/lex/lib && \
23725031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
23825031Swosch	cd ${.CURDIR}/usr.bin/compile_et && \
23925031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR} && \
24025031Swosch		rm -f /usr/sbin/compile_et
24125031Swosch	cd ${.CURDIR}/usr.bin/mk_cmds && \
24225031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
24359156Swosch
24425031Swoschlibraries:
24525031Swosch	@echo "--------------------------------------------------------------"
24625031Swosch	@echo " Rebuilding ${DESTDIR}/usr/lib"
24725031Swosch	@echo "--------------------------------------------------------------"
24825031Swosch	@echo
24925031Swosch.if defined(CLOBBER)
25089981Sjoe	find ${DESTDIR}/usr/lib \! -name '*.s[ao].*' -a \! -type d | \
25125031Swosch		xargs rm -rf
25225031Swosch.endif
25325031Swosch	cd ${.CURDIR}/gnu/lib && \
25424424Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
25525031Swosch	cd ${.CURDIR}/gnu/usr.bin/cc/libgcc && \
25625031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
25789981Sjoe.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
25825031Swosch	cd ${.CURDIR}/secure/lib && \
25989981Sjoe		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
26089981Sjoe.endif
26125031Swosch.if exists(lib)
26289981Sjoe	cd ${.CURDIR}/lib/csu/i386 && \
26389981Sjoe		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
26489981Sjoe	cd ${.CURDIR}/lib && \
26570110Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
26671231Sitojun.endif
26770110Swosch	cd ${.CURDIR}/usr.bin/lex/lib && \
26825031Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
26971231Sitojun.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
27071231Sitojun	cd ${.CURDIR}/eBones/des && \
27169278Sasmodai		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
27225031Swosch	cd ${.CURDIR}/eBones/acl && \
27371231Sitojun		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
27470110Swosch	cd ${.CURDIR}/eBones/kdb && \
27571231Sitojun		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
27670110Swosch	cd ${.CURDIR}/eBones/krb && \
27770110Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
27871231Sitojun.endif
27970110Swosch
28057000Swoschtools:
28125031Swosch	@echo "--------------------------------------------------------------"
28245349Swosch	@echo " Rebuilding ${DESTDIR} Compiler and Make"
28378270Snik	@echo "--------------------------------------------------------------"
28471231Sitojun	@echo
28525031Swosch	cd ${.CURDIR}/gnu/usr.bin/cc && \
28638440Sjkh		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
28738440Sjkh	cd ${.CURDIR}/usr.bin/make && \
28849392Swosch		${MAKE} depend all install ${CLEANDIR} ${OBJDIR}
28957000Swosch
29038440Sjkh.include <bsd.subdir.mk>
29138440Sjkh