diff options
author | imp <imp@FreeBSD.org> | 2011-01-31 15:17:47 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2011-01-31 15:17:47 +0000 |
commit | 2131e1901390a6c52fb5f11784f08408f89b04fc (patch) | |
tree | c23dc7b30cad8aa8fa1ff0c6349499b8b232bd49 | |
parent | 730eb4b414c93bfb86fc66064858b968d0321e93 (diff) | |
download | FreeBSD-src-2131e1901390a6c52fb5f11784f08408f89b04fc.zip FreeBSD-src-2131e1901390a6c52fb5f11784f08408f89b04fc.tar.gz |
Move the architecture guessing from Makefile.inc1 to Makefile. We
need to do this because variables specified on the command line
override those specified in the Makefile. This is why we also moved
from TARGET to _TARGET in Makefile, and then set TARGET on the command
line when we fork a submake with Makefile.inc1.
This makes mips/mips work again, even without the workaround committed to
lib/libc/Makefile.
-rw-r--r-- | Makefile | 35 | ||||
-rw-r--r-- | Makefile.inc1 | 26 |
2 files changed, 33 insertions, 28 deletions
@@ -126,6 +126,38 @@ BINMAKE= \ -m ${.CURDIR}/share/mk _MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 +# Guess machine architecture from machine type, and vice versa. +.if !defined(TARGET_ARCH) && defined(TARGET) +_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/} +.elif !defined(TARGET) && defined(TARGET_ARCH) && \ + ${TARGET_ARCH} != ${MACHINE_ARCH} +_TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/} +.endif +# Legacy names, for a transition period mips:mips -> mipsel:mips +.if defined(TARGET) && defined(TARGET_ARCH) && \ + ${TARGET_ARCH} == "mips" && ${TARGET} == "mips" +.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb" +.if defined(TARGET_BIG_ENDIAN) +_TARGET_ARCH=mipseb +.else +_TARGET_ARCH=mipsel +.endif +.endif +# arm with TARGET_BIG_ENDIAN -> armeb +.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) +.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" +_TARGET_ARCH=armeb +.endif +.if defined(TARGET) && !defined(_TARGET) +_TARGET=${TARGET} +.endif +.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH) +_TARGET_ARCH=${TARGET_ARCH} +.endif +# Otherwise, default to current machine type and architecture. +_TARGET?= ${MACHINE} +_TARGET_ARCH?= ${MACHINE_ARCH} + # # Make sure we have an up-to-date make(1). Only world and buildworld # should do this as those are the initial targets used for upgrades. @@ -173,8 +205,7 @@ cleanworld: # ${TGTS}: - ${_+_}@cd ${.CURDIR}; \ - ${_MAKE} ${.TARGET} + ${_+_}cd ${.CURDIR}; ${_MAKE} TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH} ${.TARGET} # Set a reasonable default .MAIN: all diff --git a/Makefile.inc1 b/Makefile.inc1 index f89d981..06d6951 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -116,32 +116,6 @@ VERSION!= uname -srp VERSION+= ${OSRELDATE} .endif -# Guess machine architecture from machine type, and vice versa. -.if !defined(TARGET_ARCH) && defined(TARGET) -TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/} -.elif !defined(TARGET) && defined(TARGET_ARCH) && \ - ${TARGET_ARCH} != ${MACHINE_ARCH} -TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/} -.endif -# Legacy names, for a transition period mips:mips -> mipsel:mips -.if defined(TARGET) && defined(TARGET_ARCH) && \ - ${TARGET_ARCH} == "mips" && ${TARGET} == "mips" -.warning "TARGET_ARCH of mips is deprecated in favor of mipsel or mipseb" -.if defined(TARGET_BIG_ENDIAN) -TARGET_ARCH=mipseb -.else -TARGET_ARCH=mipsel -.endif -.endif -# arm with TARGET_BIG_ENDIAN -> armeb -.if defined(TARGET_ARCH) && ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN) -.warning "TARGET_ARCH of arm with TARGET_BIG_ENDIAN is deprecated. use armeb" -TARGET_ARCH=armeb -.endif -# Otherwise, default to current machine type and architecture. -TARGET?= ${MACHINE} -TARGET_ARCH?= ${MACHINE_ARCH} - KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} |