diff options
Diffstat (limited to 'Makefile.inc1')
-rw-r--r-- | Makefile.inc1 | 91 |
1 files changed, 36 insertions, 55 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index 9c3614315a63..24ca96ccac4f 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -20,7 +20,7 @@ # -DNO_PORTSUPDATE do not update ports in ${MAKE} update # -DNO_DOCUPDATE do not update doc in ${MAKE} update # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list -# MACHINE_ARCH="machine arch" to crossbuild world to a different arch +# TARGET_ARCH="arch" to crossbuild world to a different arch # # The intended user-driven targets are: @@ -121,13 +121,18 @@ SUPFLAGS+= -h ${SUPHOST} MAKEOBJDIRPREFIX?= /usr/obj TARGET_ARCH?= ${MACHINE_ARCH} +.if make(buildworld) BUILD_ARCH!= sysctl -n hw.machine_arch -.if ${BUILD_ARCH} == ${MACHINE_ARCH} +.if ${MACHINE_ARCH} != ${BUILD_ARCH} +.error To cross-build, set TARGET_ARCH. +.endif +.endif +.if ${MACHINE_ARCH} == ${TARGET_ARCH} OBJTREE= ${MAKEOBJDIRPREFIX} .else -OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH} +OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET_ARCH} .endif -WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH} +WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH} # /usr/games added for fortune which depend on strfile STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games TMPPATH= ${STRICTTMPPATH}:${PATH} @@ -158,42 +163,34 @@ INSTALLTMP= ${TMPDIR}/install.${TMPPID} # This stage installs a previously built world. # -# Common environment for bootstrap related stages -BOOTSTRAPENV= MAKEOBJDIRPREFIX=${WORLDTMP} \ - DESTDIR=${WORLDTMP} \ - INSTALL="sh ${.CURDIR}/tools/install.sh" \ - MACHINE_ARCH=${BUILD_ARCH} \ - TOOLS_PREFIX=${WORLDTMP} \ - PATH=${TMPPATH} - # Common environment for world related stages CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ + MACHINE_ARCH=${TARGET_ARCH} \ COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \ OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ CFLAGS="-nostdinc ${CFLAGS}" \ + CXXINCLUDES="-nostdinc++ ${CXXINCLUDES}" \ PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.6.0 \ GROFF_BIN_PATH=${WORLDTMP}/usr/bin \ GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \ GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac # bootstrap-tool stage -BMAKEENV= ${BOOTSTRAPENV} +BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \ + DESTDIR= \ + INSTALL="sh ${.CURDIR}/tools/install.sh" BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ -DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED # build-tool stage TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \ - INSTALL="sh ${.CURDIR}/tools/install.sh" \ - PATH=${TMPPATH} + DESTDIR= \ + INSTALL="sh ${.CURDIR}/tools/install.sh" TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 # cross-tool stage -XMAKEENV= ${BOOTSTRAPENV} \ - TARGET_ARCH=${MACHINE_ARCH} -XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ - -DNO_FORTRAN -DNO_GDB -DNOHTML -DNOINFO -DNOMAN \ - -DNOPIC -DNOPROFILE -DNOSHARED +XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB # world stage WMAKEENV= ${CROSSENV} \ @@ -246,13 +243,6 @@ buildworld: @echo "--------------------------------------------------------------" .if !defined(NOCLEAN) rm -rf ${WORLDTMP} -.else - for dir in bin games include lib sbin share; do \ - rm -rf ${WORLDTMP}/usr/$$dir; \ - done - # XXX - Work-around for broken cc/cc_tools/Makefile. - # This is beyond dirty... - rm -f ${OBJTREE}${.CURDIR}/gnu/usr.bin/cc/cc_tools/.depend .endif .for _dir in ${USRDIRS} mkdir -p ${WORLDTMP}/${_dir} @@ -271,13 +261,13 @@ buildworld: @echo "--------------------------------------------------------------" @echo ">>> stage 2: cleaning up the object tree" @echo "--------------------------------------------------------------" - cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/} + cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} .endif @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2: rebuilding the object tree" @echo "--------------------------------------------------------------" - cd ${.CURDIR}; ${TMAKE} par-obj + cd ${.CURDIR}; ${WMAKE} par-obj @echo @echo "--------------------------------------------------------------" @echo ">>> stage 2: build tools" @@ -324,7 +314,7 @@ installworld: mkdir -p ${INSTALLTMP} for prog in [ awk cat chflags chmod chown date echo egrep find grep \ ln make makewhatis mkdir mtree mv perl rm sed sh sysctl \ - test true uname wc which zic; do \ + test true uname wc zic; do \ cp `which $$prog` ${INSTALLTMP}; \ done cd ${.CURDIR}; ${IMAKE} reinstall @@ -373,8 +363,8 @@ distribworld: # for building kernels and only the first of these is designated # as the one being installed. # -# Note that we have to use MACHINE instead of MACHINE_ARCH when -# we're in kernel-land. Since only MACHINE_ARCH is (expected) to +# Note that we have to use MACHINE instead of TARGET_ARCH when +# we're in kernel-land. Since only TARGET_ARCH is (expected) to # be set to cross-build, we have to make sure MACHINE is set # properly. @@ -386,11 +376,11 @@ KERNCONF?= GENERIC .endif INSTKERNNAME?= kernel -# The only exotic MACHINE_ARCH/MACHINE combination valid at this +# The only exotic TARGET_ARCH/MACHINE combination valid at this # time is i386/pc98. In all other cases set MACHINE equal to -# MACHINE_ARCH. -.if ${MACHINE_ARCH} != "i386" || ${MACHINE} != "pc98" -MACHINE= ${MACHINE_ARCH} +# TARGET_ARCH. +.if ${TARGET_ARCH} != "i386" || ${MACHINE} != "pc98" +MACHINE= ${TARGET_ARCH} .endif KRNLSRCDIR= ${.CURDIR}/sys @@ -572,7 +562,7 @@ bootstrap-tools: ${MAKE} obj; \ ${MAKE} depend; \ ${MAKE} all; \ - ${MAKE} install + ${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install .endfor # @@ -590,6 +580,10 @@ _share= share/syscons/scrnmaps _fortran= gnu/usr.bin/cc/f771 .endif +.if !defined(NOPERL) +_perl= gnu/usr.bin/perl/miniperl +.endif + .if exists(${.CURDIR}/kerberosIV) && exists(${.CURDIR}/crypto) && \ !defined(NOCRYPT) && defined(MAKE_KERBEROS4) _libroken4= kerberosIV/lib/libroken @@ -602,7 +596,7 @@ _libkrb5= kerberos5/lib/libasn1 kerberos5/lib/libhdb kerberos5/lib/libsl build-tools: .for _tool in bin/csh bin/sh ${_games} gnu/usr.bin/cc/cc_tools ${_fortran} \ - ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.bin/file \ + ${_perl} ${_libroken4} ${_libkrb5} lib/libncurses ${_share} usr.bin/file \ usr.sbin/sysinstall cd ${.CURDIR}/${_tool}; ${MAKE} build-tools .endfor @@ -610,17 +604,6 @@ build-tools: # # cross-tools: Build cross-building tools # -# WARNING: Because the bootstrap tools are expected to run on the -# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this -# target is being made. TARGET_ARCH is *always* set to reflect the -# target-machine (which you can set by specifying MACHINE_ARCH on -# make's command-line, get it?). -# The reason is simple: we build these tools not to be run on the -# architecture we're cross-building, but on the architecture we're -# currently building on (ie the host-machine) and we expect these -# tools to produce output for the architecture we're trying to -# cross-build. -# .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha" _elf2exe= usr.sbin/elf2exe .endif @@ -629,18 +612,14 @@ _elf2exe= usr.sbin/elf2exe _btxld= usr.sbin/btxld .endif -.if !defined(NOPERL) -_perl= gnu/usr.bin/perl/libperl gnu/usr.bin/perl/miniperl -.endif - cross-tools: -.for _tool in ${_btxld} ${_elf2exe} ${_perl} \ +.for _tool in ${_btxld} ${_elf2exe} \ gnu/usr.bin/binutils usr.bin/objformat gnu/usr.bin/cc cd ${.CURDIR}/${_tool}; \ ${MAKE} obj; \ ${MAKE} depend; \ ${MAKE} all; \ - ${MAKE} install + ${MAKE} DESTDIR=${MAKEOBJDIRPREFIX} install .endfor # @@ -677,6 +656,8 @@ includes: cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall +.elif exists(${.CURDIR}/secure) && !defined(NOCRYPT) && !defined(NOSECURE) + cd ${.CURDIR}/secure/lib/libtelnet; ${MAKE} beforeinstall .else cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall .endif |