diff --git a/Makefile b/Makefile index e23e84cd5fb3..3bb7ad53ba16 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.131 1997/07/31 08:06:29 asami Exp $ +# $Id: Makefile,v 1.132 1997/07/31 08:31:50 asami Exp $ # # Make command line options: # -DCLOBBER will remove /usr/include @@ -22,8 +22,9 @@ # # The intended user-driven targets are: -# world - rebuild *everything*, including glue to help do upgrades. -# reinstall - use an existing (eg: NFS mounted) build to do an update. +# buildworld - rebuild *everything*, including glue to help do upgrades +# installworld- install everything built by "buildworld" +# world - buildworld + installworld # update - convenient way to update your source tree (eg: sup/cvs) # most - build user commands, no libraries or include files # installmost - install user commands, no libraries or include files @@ -32,19 +33,14 @@ # /usr/share/mk. These include: # obj depend all install clean cleandepend cleanobj +.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) .MAKEFLAGS:= ${.MAKEFLAGS} -m ${.CURDIR}/share/mk +.endif # Put initial settings here. SUBDIR= -# We must do share/info early so that installation of info `dir' -# entries works correctly. Do it first since it is less likely to -# grow dependencies on include and lib than vice versa. -.if exists(share/info) -SUBDIR+= share/info -.endif - -# We must do include and lib early so that the perl *.ph generation +# We must do include and lib first so that the perl *.ph generation # works correctly as it uses the header files installed by this. .if exists(include) SUBDIR+= include @@ -122,8 +118,8 @@ CLEANDIR= cleandir .endif .endif -SUP?= sup -SUPFLAGS?= -v +SUP?= sup +SUPFLAGS?= -v # # While building tools for bootstrapping, we dont need to waste time on @@ -144,82 +140,14 @@ world: @echo "make world started on `LC_TIME=C date`" @echo "--------------------------------------------------------------" .if target(pre-world) + @echo @echo "--------------------------------------------------------------" @echo " Making 'pre-world' target" @echo "--------------------------------------------------------------" cd ${.CURDIR} && ${MAKE} pre-world - @echo .endif - @echo "--------------------------------------------------------------" - @echo " Making hierarchy" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} hierarchy - @echo - @echo "--------------------------------------------------------------" - @echo " Cleaning up the source tree" - @echo "--------------------------------------------------------------" -.if defined(NOCLEAN) - @echo "Not cleaning anything! I sure hope you know what you are doing!" -.else - cd ${.CURDIR} && ${MAKE} ${CLEANDIR} -.endif - @echo -.if !defined(NOOBJDIR) - @echo "--------------------------------------------------------------" - @echo " Rebuilding the obj tree" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} obj - @echo -.endif - @echo "--------------------------------------------------------------" - @echo " Rebuilding bootstrap tools" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} bootstrap - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding tools necessary to build the include files" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} include-tools - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding /usr/include" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} includes - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding tools needed to build the libraries" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} lib-tools - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding /usr/lib" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} libraries - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding symorder, groff and zic(8)" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} build-tools - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding dependencies" - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} depend - @echo - @echo "--------------------------------------------------------------" - @echo " Building everything.." - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} all - @echo - @echo "--------------------------------------------------------------" - @echo " Installing everything.." - @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} install - @echo - @echo "--------------------------------------------------------------" - @echo " Rebuilding man page indexes" - @echo "--------------------------------------------------------------" - cd ${.CURDIR}/share/man && ${MAKE} makedb + cd ${.CURDIR} && ${MAKE} buildworld + cd ${.CURDIR} && ${MAKE} installworld .if target(post-world) @echo @echo "--------------------------------------------------------------" @@ -232,6 +160,132 @@ world: @echo "make world completed on `LC_TIME=C date`" @echo "--------------------------------------------------------------" +.if defined(MAKEOBJDIRPREFIX) +WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp +.else +WORLDTMP= /usr/obj${.CURDIR}/tmp +.endif +STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin +TMPPATH= ${STRICTTMPPATH}:${PATH} + +# XXX COMPILER_PATH is needed for finding cc1, ld and as +# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecssary now +# tbat LIBRARY_PATH is set. We still can't use -nostdlib, since gcc +# wouldn't link *crt.o or libgcc if it were used. +# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't +# want that - all compile-time library paths should be resolved by gcc. +# It fails for set[ug]id executables (are any used?). +COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ + COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ + GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \ + LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ + LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib + +BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t +XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ + CC='cc -nostdinc' # XXX -nostdlib + +# used to compile and install 'make' in temporary build tree +IBMAKE= ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP} +# bootstrap make +BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP} +# cross make used for compilation +XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP} +# cross make used for final installation +IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} + +# +# buildworld +# +# Attempt to rebuild the entire system, with reasonable chance of +# success, regardless of how old your existing system is. +# +buildworld: +.if !defined(NOCLEAN) + @echo + @echo "--------------------------------------------------------------" + @echo " Cleaning up the temporary build tree" + @echo "--------------------------------------------------------------" + mkdir -p ${WORLDTMP} + chflags -R noschg ${WORLDTMP}/ + rm -rf ${WORLDTMP} +.endif + @echo + @echo "--------------------------------------------------------------" + @echo " Making make" + @echo "--------------------------------------------------------------" + mkdir -p ${WORLDTMP}/usr/bin + cd ${.CURDIR}/usr.bin/make && \ + ${IBMAKE} -I${.CURDIR}/share/mk ${OBJDIR} clean cleandepend depend && \ + ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all install clean cleandepend + @echo + @echo "--------------------------------------------------------------" + @echo " Making hierarchy" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} hierarchy +.if !defined(NOCLEAN) + @echo + @echo "--------------------------------------------------------------" + @echo " Cleaning up the obj tree" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} ${CLEANDIR} +.endif +.if !defined(NOOBJDIR) + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding the obj tree" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} obj +.endif + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding bootstrap tools" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} bootstrap + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding tools necessary to build the include files" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} include-tools + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding /usr/include" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} includes + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding tools needed to build the libraries" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} lib-tools + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding /usr/lib" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} libraries + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding all other tools needed to build the world" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${BMAKE} build-tools + @echo + @echo "--------------------------------------------------------------" + @echo " Rebuilding dependencies" + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${XMAKE} depend + @echo + @echo "--------------------------------------------------------------" + @echo " Building everything.." + @echo "--------------------------------------------------------------" + cd ${.CURDIR} && ${XMAKE} all + +# +# installworld +# +# Installs everything compiled by a 'buildworld'. +# +installworld: + cd ${.CURDIR} && ${IXMAKE} reinstall + # # reinstall # @@ -255,7 +309,6 @@ reinstall: @echo "--------------------------------------------------------------" cd ${.CURDIR}/share/man && ${MAKE} makedb - # # update # @@ -282,7 +335,6 @@ update: cd ${.CURDIR} && cvs -q update -P -d .endif - # # most # @@ -355,6 +407,12 @@ hierarchy: # for the dependency information to be gathered from. # bootstrap: +.if defined(DESTDIR) + rm -f ${DESTDIR}/usr/src/sys + ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src + cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include + cd ${.CURDIR}/include && make symlinks +.endif cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \ ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \ @@ -366,11 +424,13 @@ bootstrap: # include-tools - generally the same as 'bootstrap', except that it's for # things that are specifically needed to generate include files. # -# XXX should be merged with bootstrap, it's not worth keeeping them seperate +# XXX should be merged with bootstrap, it's not worth keeeping them separate. +# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies +# on cleaned away headers in ${WORLDTMP}. # include-tools: - cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR} + cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} cleandepend depend && \ + ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} # # includes - possibly generate and install the include files. @@ -388,7 +448,6 @@ includes: cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall - cd ${.CURDIR}/gnu/lib/libmp && ${MAKE} beforeinstall .if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES) cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall @@ -420,34 +479,26 @@ includes: # # lib-tools - build tools to compile and install the libraries. # +# XXX gperf is required for cc +# XXX a new ld and tsort is required for cc lib-tools: - cd ${.CURDIR}/usr.bin/tsort && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/gnu/usr.bin/ld && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/gnu/usr.bin/as && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/ar && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/ranlib && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/nm && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/compile_et && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} && \ - rm -f /usr/sbin/compile_et - cd ${.CURDIR}/usr.bin/mk_cmds && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/usr.bin/uudecode && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/gnu/usr.bin/bison && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/gnu/usr.bin/gperf && ${MAKE} depend && \ - ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} - cd ${.CURDIR}/gnu/usr.bin/cc && ${MAKE} depend && \ +.for d in \ + gnu/usr.bin/gperf \ + gnu/usr.bin/ld \ + usr.bin/tsort \ + gnu/usr.bin/as \ + gnu/usr.bin/bison \ + gnu/usr.bin/cc \ + usr.bin/ar \ + usr.bin/compile_et \ + usr.bin/lex/lib \ + usr.bin/mk_cmds \ + usr.bin/nm \ + usr.bin/ranlib \ + usr.bin/uudecode + cd ${.CURDIR}/$d && ${MAKE} depend && \ ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} +.endfor # # libraries - build and install the libraries @@ -497,15 +548,70 @@ libraries: # # build-tools - build and install any other tools needed to complete the # compile and install. +# ifdef stale +# bc and cpp are required to build groff. Otherwise, the order here is +# mostly historical, i.e., bogus. +# chmod is used to build gcc's tmpmultilib[2] at obscure times. +# endif stale +# XXX uname is a bug - the target should not depend on the host. # build-tools: .for d in \ - share/info \ - gnu/usr.bin/texinfo \ - usr.bin/symorder \ - usr.sbin/zic \ + bin/cat \ + bin/chmod \ + bin/cp \ + bin/date \ + bin/dd \ + bin/echo \ + bin/expr \ + bin/hostname \ + bin/ln \ + bin/ls \ + bin/mkdir \ + bin/mv \ + bin/rm \ + bin/sh \ + bin/test \ gnu/usr.bin/awk \ - gnu/usr.bin/groff + gnu/usr.bin/bc \ + gnu/usr.bin/grep \ + gnu/usr.bin/groff \ + gnu/usr.bin/gzip \ + gnu/usr.bin/man/makewhatis \ + gnu/usr.bin/sort \ + gnu/usr.bin/texinfo \ + share/info \ + usr.bin/basename \ + usr.bin/cap_mkdb \ + usr.bin/chflags \ + usr.bin/cmp \ + usr.bin/col \ + usr.bin/cpp \ + usr.bin/expand \ + usr.bin/file2c \ + usr.bin/find \ + usr.bin/gencat \ + usr.bin/lorder \ + usr.bin/m4 \ + usr.bin/mkdep \ + usr.bin/paste \ + usr.bin/sed \ + usr.bin/size \ + usr.bin/soelim \ + usr.bin/strip \ + usr.bin/symorder \ + usr.bin/touch \ + usr.bin/tr \ + usr.bin/true \ + usr.bin/uname \ + usr.bin/uuencode \ + usr.bin/vgrind \ + usr.bin/vi \ + usr.bin/wc \ + usr.bin/yacc \ + usr.sbin/chown \ + usr.sbin/mtree \ + usr.sbin/zic cd ${.CURDIR}/$d && ${MAKE} depend && \ ${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} .endfor diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 0fd763371307..648de6aff56f 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 -# $Id: bsd.lib.mk,v 1.58 1997/06/18 03:39:34 asami Exp $ +# $Id: bsd.lib.mk,v 1.59 1997/06/21 15:40:32 jkh Exp $ # .if exists(${.CURDIR}/../Makefile.inc) @@ -186,10 +186,12 @@ _EXTRADEPEND:: > $$TMP; \ mv $$TMP ${DEPENDFILE} .endif +.if !defined(NOEXTRADEPEND) _EXTRADEPEND:: echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \ `${LDDESTDIRENV} ${CC} -shared -Wl,-f ${LDDESTDIR} ${LDADD}` \ >> ${DEPENDFILE} +.endif .if !target(install) .if !target(beforeinstall) diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 8e39cd49c437..febc39300a38 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id: bsd.prog.mk,v 1.52 1997/06/28 08:14:10 pst Exp $ +# $Id: bsd.prog.mk,v 1.53 1997/07/31 06:12:04 asami Exp $ .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" @@ -63,7 +63,7 @@ clean: _SUBDIR .endif .endif -.if defined(PROG) +.if defined(PROG) && !defined(NOEXTRADEPEND) _EXTRADEPEND: echo ${PROG}: `${CC} -Wl,-f ${CFLAGS} ${LDFLAGS} ${LDDESTDIR} \ ${LDADD:S/^/-Wl,/}` >> ${DEPENDFILE}