diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 276 |
1 files changed, 191 insertions, 85 deletions
@@ -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,93 +140,151 @@ 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 + cd ${.CURDIR} && ${MAKE} buildworld + cd ${.CURDIR} && ${MAKE} installworld +.if target(post-world) + @echo @echo "--------------------------------------------------------------" - @echo " Making hierarchy" + @echo " Making 'post-world' target" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} hierarchy + cd ${.CURDIR} && ${MAKE} post-world +.endif @echo @echo "--------------------------------------------------------------" - @echo " Cleaning up the source tree" + @echo "make world completed on `LC_TIME=C date`" @echo "--------------------------------------------------------------" -.if defined(NOCLEAN) - @echo "Not cleaning anything! I sure hope you know what you are doing!" + +.if defined(MAKEOBJDIRPREFIX) +WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp .else - cd ${.CURDIR} && ${MAKE} ${CLEANDIR} +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 -.if !defined(NOOBJDIR) @echo "--------------------------------------------------------------" - @echo " Rebuilding the obj tree" + @echo " Cleaning up the temporary build tree" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} obj - @echo + mkdir -p ${WORLDTMP} + chflags -R noschg ${WORLDTMP}/ + rm -rf ${WORLDTMP} .endif + @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding bootstrap tools" + @echo " Making make" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} bootstrap + 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 " Rebuilding tools necessary to build the include files" + @echo " Making hierarchy" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} include-tools + cd ${.CURDIR} && ${BMAKE} hierarchy +.if !defined(NOCLEAN) @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding /usr/include" + @echo " Cleaning up the obj tree" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} includes + cd ${.CURDIR} && ${BMAKE} ${CLEANDIR} +.endif +.if !defined(NOOBJDIR) @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding tools needed to build the libraries" + @echo " Rebuilding the obj tree" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} lib-tools + cd ${.CURDIR} && ${BMAKE} obj +.endif @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding /usr/lib" + @echo " Rebuilding bootstrap tools" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} libraries + cd ${.CURDIR} && ${BMAKE} bootstrap @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding symorder, groff and zic(8)" + @echo " Rebuilding tools necessary to build the include files" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} build-tools + cd ${.CURDIR} && ${BMAKE} include-tools @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding dependencies" + @echo " Rebuilding /usr/include" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} depend + cd ${.CURDIR} && ${BMAKE} includes @echo @echo "--------------------------------------------------------------" - @echo " Building everything.." + @echo " Rebuilding tools needed to build the libraries" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} all + cd ${.CURDIR} && ${BMAKE} lib-tools @echo @echo "--------------------------------------------------------------" - @echo " Installing everything.." + @echo " Rebuilding /usr/lib" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} install + cd ${.CURDIR} && ${BMAKE} libraries @echo @echo "--------------------------------------------------------------" - @echo " Rebuilding man page indexes" + @echo " Rebuilding all other tools needed to build the world" @echo "--------------------------------------------------------------" - cd ${.CURDIR}/share/man && ${MAKE} makedb -.if target(post-world) + cd ${.CURDIR} && ${BMAKE} build-tools @echo @echo "--------------------------------------------------------------" - @echo " Making 'post-world' target" + @echo " Rebuilding dependencies" @echo "--------------------------------------------------------------" - cd ${.CURDIR} && ${MAKE} post-world -.endif + cd ${.CURDIR} && ${XMAKE} depend @echo @echo "--------------------------------------------------------------" - @echo "make world completed on `LC_TIME=C date`" + @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 \ + 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/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.sbin/zic \ - gnu/usr.bin/awk \ - gnu/usr.bin/groff + 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 |