svn commit: r322429 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk

Warner Losh imp at FreeBSD.org
Sat Aug 12 17:07:28 UTC 2017


Author: imp
Date: Sat Aug 12 17:07:27 2017
New Revision: 322429
URL: https://svnweb.freebsd.org/changeset/base/322429

Log:
  Make _TO_CPUARCH macro for ARCH to CPUARCH conversions
  
  Consolidate all the regular expressions to convert from MACHINE_ARCH
  to MACHINE_CPUARCH into a variable and use that variable in preference
  to the almost identical copies in the tree (which should have been
  identical).
  
  Differential Revision: https://reviews.freebsd.org/D11986

Modified:
  head/Makefile
  head/gnu/usr.bin/binutils/Makefile.inc0
  head/gnu/usr.bin/cc/Makefile.tgt
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/libgdb/Makefile
  head/share/mk/sys.mk

Modified: head/Makefile
==============================================================================
--- head/Makefile	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/Makefile	Sat Aug 12 17:07:27 2017	(r322429)
@@ -245,12 +245,17 @@ _MAKE+=	MK_META_MODE=no
 .endif	# !exists(/dev/filemon) && !defined(NO_FILEMON)
 .endif	# !defined(_CAN_USE_META_MODE)
 
-# Guess machine architecture from machine type, and vice versa.
+# Guess target architecture from target type, and vice versa, based on
+# historic FreeBSD practice of tending to have TARGET == TARGET_ARCH
+# expanding to TARGET == TARGET_CPUARCH in recent times, with known
+# exceptions.
 .if !defined(TARGET_ARCH) && defined(TARGET)
+# T->TA mapping is usually TARGET with arm64 the odd man out
 _TARGET_ARCH=	${TARGET:S/arm64/aarch64/}
 .elif !defined(TARGET) && defined(TARGET_ARCH) && \
     ${TARGET_ARCH} != ${MACHINE_ARCH}
-_TARGET=		${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/}
+# TA->T mapping is accidentally CPUARCH with aarch64 the odd man out
+_TARGET=	${TARGET_ARCH:${__TO_CPUARCH}:C/aarch64/arm64/}
 .endif
 .if defined(TARGET) && !defined(_TARGET)
 _TARGET=${TARGET}

Modified: head/gnu/usr.bin/binutils/Makefile.inc0
==============================================================================
--- head/gnu/usr.bin/binutils/Makefile.inc0	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/gnu/usr.bin/binutils/Makefile.inc0	Sat Aug 12 17:07:27 2017	(r322429)
@@ -7,7 +7,7 @@
 VERSION=	"2.17.50 [FreeBSD] 2007-07-03"
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/cc/Makefile.tgt
==============================================================================
--- head/gnu/usr.bin/cc/Makefile.tgt	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/gnu/usr.bin/cc/Makefile.tgt	Sat Aug 12 17:07:27 2017	(r322429)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv64/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==============================================================================
--- head/gnu/usr.bin/gdb/Makefile.inc	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/gnu/usr.bin/gdb/Makefile.inc	Sat Aug 12 17:07:27 2017	(r322429)
@@ -23,7 +23,7 @@ OBJ_RL= ${OBJTOP}/gnu/lib/libreadline/readline
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/gnu/usr.bin/gdb/libgdb/Makefile
==============================================================================
--- head/gnu/usr.bin/gdb/libgdb/Makefile	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/gnu/usr.bin/gdb/libgdb/Makefile	Sat Aug 12 17:07:27 2017	(r322429)
@@ -4,7 +4,7 @@
 # MACHINE_CPUARCH, but there's no easy way to export make functions...
 
 .if defined(TARGET_ARCH)
-TARGET_CPUARCH=${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/}
+TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}}
 .else
 TARGET_CPUARCH=${MACHINE_CPUARCH}
 .endif

Modified: head/share/mk/sys.mk
==============================================================================
--- head/share/mk/sys.mk	Sat Aug 12 15:51:46 2017	(r322428)
+++ head/share/mk/sys.mk	Sat Aug 12 17:07:27 2017	(r322429)
@@ -8,12 +8,13 @@ unix		?=	We run FreeBSD, not UNIX.
 #
 # MACHINE_CPUARCH defines a collection of MACHINE_ARCH.  Machines with
 # the same MACHINE_ARCH can run each other's binaries, so it necessarily
-# has word size and endian swizzled in.  However, support files for
+# has word size and endian swizzled in.  However, the source files for
 # these machines often are shared amongst all combinations of size
 # and/or endian.  This is called MACHINE_CPU in NetBSD, but that's used
 # for something different in FreeBSD.
 #
-MACHINE_CPUARCH=${MACHINE_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/}
+__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb|hf)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/
+MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}}
 .endif
 
 


More information about the svn-src-head mailing list