From owner-svn-src-head@freebsd.org Sat Aug 12 17:07:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D98D93F9A; Sat, 12 Aug 2017 17:07:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9EA696871B; Sat, 12 Aug 2017 17:07:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7CH7Rca079852; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7CH7Rjh079846; Sat, 12 Aug 2017 17:07:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708121707.v7CH7Rjh079846@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 12 Aug 2017 17:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322429 - in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . gnu/usr.bin/binutils gnu/usr.bin/cc gnu/usr.bin/gdb gnu/usr.bin/gdb/libgdb share/mk X-SVN-Commit-Revision: 322429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Aug 2017 17:07:28 -0000 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