diff options
author | ru <ru@FreeBSD.org> | 2001-09-29 13:17:54 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-09-29 13:17:54 +0000 |
commit | 0579c777d9b29d130ff30dd785721affe0a6fe03 (patch) | |
tree | 8117c933d52263b2b6158bc073d28d25695c829d /Makefile.inc1 | |
parent | a6cad80bb4768dd71cb6375107e4ba547f48f27e (diff) | |
download | FreeBSD-src-0579c777d9b29d130ff30dd785721affe0a6fe03.zip FreeBSD-src-0579c777d9b29d130ff30dd785721affe0a6fe03.tar.gz |
Fix cross-building, etc:
1. To cross-build, one now needs to set TARGET_ARCH, and not the
MACHINE_ARCH. MACHINE_ARCH should never be changed manually!
2. Initialize DESTDIR= explicitly for bootstrap-tools, build-tools,
and cross-tools stages. This fixes broken header and library
dependencies problem. We build them in the host environment,
and obviously want them to depend on host headers and libraries.
The problem with broken header dependencies for bootstrap-tools
and cross-tools was already partially solved (see BOOTSTRAPPING
tests in bsd.prog.mk and bsd.lib.mk), but it was still there for
build-tools if the user ran "make world DESTDIR=/foo". Also,
for all of these stages, the library dependencies were broken
because of how bsd.libnames.mk define DPADD members.
We still provide a glue to install bootstrap- and cross-tools
under the ${WORLDTMP}.
Removed PATH overrides for bootstrap-, build-, and cross-tools
stages. There is just no reason why we would need to override
it, and the hacks to clean up the ${WORLDTMP} in the -DNOCLEAN
case are no longer needed with fixes from this step.
That is, we now never use ${WORLDTMP} headers and libraries,
and we don't use any ${WORLDTMP} installed binaries during
these stages. Again, these stages depend solely on the host
environment, including compiler, headers, and libraries.
3. Moved "miniperl" back from cross-tools (it has nothing to do
with a cross-compiler) to build-tools where it belongs. The
change from step 1 let to do this. Also, to make this work,
build-tools targets of "cc_tools" and "miniperl" were modified
to call "depend". Here follow the detailed explanations.
There are two categories of build tools, for now. In the first
category there are "cc_tools" and "miniperl". They occupy the
whole (sub)directory, and nothing needs to be done in this
subdirectory later during the "all" stage. They are also
constructed using system makefiles. We must build the .depend
early in the build-tools stage because:
1) They use (and depend on) the host environment.
2) If we don't do this in build-tools, the "depend" stage of
buildworld will do this for us; wrong library and header
dependencies will be recorded (DESTDIR=${WORLDTMP}) and,
what's worse, the "all" stage may then clobber the
build-architecture format tools (that we built in the
build-tools stage) with the target-architecture format
ones, breaking cross build.
In the second category there are all other build-tools. They
share their directory with the "main" module that needs them
in the "all" stage, and they don't show up themselves in the
.depend file. The portion of this fix was already committed
in gnu/usr.bin/cc/cc_tools/Makefile,v 1.52.
4. "libperl" is no longer a build tool, and "miniperl" is the
stand-alone application. I had to make this change because
build-tools and "all" stages share the same object directory.
Without this change, if we cross compile, libperl.a is first
built for the build architecture during the build-tools stage
(for the purposes of immediate linkage with "miniperl").
Later on, the "all" stage sees this library as up-to-date,
and doesn't rebuild it. The effect is that the wrong format
static libperl library is installed with installworld.
5. Fixed "includes" to install secure/lib/libtelnet headers if
required.
Reviewed by: bde
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 9c36143..24ca96c 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 |