build: include the cpu type as part of the toolchain/target directory name
authorFelix Fietkau <nbd@openwrt.org>
Thu, 26 Sep 2013 17:53:32 +0000 (17:53 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 26 Sep 2013 17:53:32 +0000 (17:53 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 38214

include/target.mk
rules.mk
scripts/metadata.pl

index c3b4c5245933793a9ce6ec31608cf3a9082441a7..4e7fdf7b90a8a260e351d1307c1df7c7871ad358 100644 (file)
@@ -254,6 +254,7 @@ define BuildTargets/DumpCurrent
         echo 'Target-Features: $(FEATURES)'; \
         echo 'Target-Depends: $(DEPENDS)'; \
         echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \
+        echo 'CPU-Type: $(CPU_TYPE)$(if $(CPU_SUBTYPE),+$(CPU_SUBTYPE))'; \
         echo 'Linux-Version: $(LINUX_VERSION)'; \
         echo 'Linux-Release: $(LINUX_RELEASE)'; \
         echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \
index 14171a0d307d52e83802ef65f4da1731a214d5f9..a3efb7db4f297783c0eed2f487e6c1a6b17e5303 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -54,22 +54,15 @@ endif
 
 HOST_FPIC:=-fPIC
 
-ARCH_SUFFIX:=
+ARCH_SUFFIX:=$(call qstrip,$(CONFIG_CPU_TYPE))
 GCC_ARCH:=
 
+ifneq ($(ARCH_SUFFIX),)
+  ARCH_SUFFIX:=_$(ARCH_SUFFIX)
+endif
 ifneq ($(filter -march=armv%,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_$(patsubst -march=arm%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION)))
   GCC_ARCH:=$(patsubst -march=%,%,$(filter -march=armv%,$(TARGET_OPTIMIZATION)))
 endif
-ifneq ($(filter -mips%r2,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=_r2
-endif
-ifneq ($(filter -mdsp,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=$(ARCH_SUFFIX)_dsp
-endif
-ifneq ($(filter -mdspr2,$(TARGET_OPTIMIZATION)),)
-  ARCH_SUFFIX:=$(ARCH_SUFFIX)_dspr2
-endif
 ifdef CONFIG_HAS_SPE_FPU
   TARGET_SUFFIX:=$(TARGET_SUFFIX)spe
 endif
index 498456ea4d5ee7f85282b46e4f7b1b9a4cdf16ad..ddcf50bf32a3b9a1e0ab4770b4a97443787e109e 100755 (executable)
@@ -53,6 +53,7 @@ sub parse_target_metadata() {
                /^Target-Depends:\s*(.+)\s*$/ and $target->{depends} = [ split(/\s+/, $1) ];
                /^Target-Description:/ and $target->{desc} = get_multiline(*FILE);
                /^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1;
+               /^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1;
                /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
                /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
                /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
@@ -372,6 +373,16 @@ EOF
                print "\tdefault \"".$target->{cflags}."\" if TARGET_".$target->{conf}."\n";
        }
        print "\tdefault \"-Os -pipe -funit-at-a-time\"\n";
+       print <<EOF;
+
+config CPU_TYPE
+       string
+EOF
+       foreach my $target (@target) {
+               next if @{$target->{subtargets}} > 0;
+               print "\tdefault \"".$target->{cputype}."\" if TARGET_".$target->{conf}."\n";
+       }
+       print "\tdefault \"\"\n";
 
        my %kver;
        foreach my $target (@target) {