From 72faa09dff0e69a6a1d4cbd0e0078573a242c817 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 14 Mar 2009 03:17:06 +0000 Subject: [PATCH] move cflags default setting to target makefiles SVN-Revision: 14866 --- include/target.mk | 8 ++++++++ rules.mk | 1 + scripts/metadata.pl | 13 +++++++++++++ target/linux/ar71xx/Makefile | 1 + target/linux/storm/Makefile | 1 + toolchain/Config.in | 11 +---------- 6 files changed, 25 insertions(+), 10 deletions(-) diff --git a/include/target.mk b/include/target.mk index ace3db0ffd..5d8baeaeb6 100644 --- a/include/target.mk +++ b/include/target.mk @@ -150,6 +150,13 @@ ifeq ($(DUMP),1) # remove duplicates FEATURES:=$(sort $(FEATURES)) endif + DEFAULT_CFLAGS_i386=-O2 -pipe -march=i486 -funit-at-a-time + DEFAULT_CFLAGS_x86_64=-O2 -pipe -march=athlon64 -funit-at-a-time + DEFAULT_CFLAGS_mips=-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time + DEFAULT_CFLAGS_mipsel=$(DEFAULT_CFLAGS_mips) + DEFAULT_CFLAGS_arm=-Os -pipe -march=armv5te -mtune=xscale -funit-at-a-time + DEFAULT_CFLAGS_armeb=$(DEFAULT_CFLAGS_arm) + DEFAULT_CFLAGS=$(if $(DEFAULT_CFLAGS_$(ARCH)),$(DEFAULT_CFLAGS_$(ARCH)),-Os -pipe -funit-at-a-time) endif define BuildTargets/DumpCurrent @@ -163,6 +170,7 @@ define BuildTargets/DumpCurrent echo 'Target-Arch: $(ARCH)'; \ echo 'Target-Features: $(FEATURES)'; \ echo 'Target-Depends: $(DEPENDS)'; \ + echo 'Target-Optimization: $(if $(CFLAGS),$(CFLAGS),$(DEFAULT_CFLAGS))'; \ echo 'Linux-Version: $(LINUX_VERSION)'; \ echo 'Linux-Release: $(LINUX_RELEASE)'; \ echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'; \ diff --git a/rules.mk b/rules.mk index 96ae8d57f7..dad7456a6b 100644 --- a/rules.mk +++ b/rules.mk @@ -29,6 +29,7 @@ confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n))) strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1)) _SINGLE=export MAKEFLAGS=$(space); +CFLAGS:= ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH))))) BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD)) TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION)) diff --git a/scripts/metadata.pl b/scripts/metadata.pl index 7496f33a7d..4002559007 100755 --- a/scripts/metadata.pl +++ b/scripts/metadata.pl @@ -52,6 +52,7 @@ sub parse_target_metadata() { /^Target-Features:\s*(.+)\s*$/ and $target->{features} = [ split(/\s+/, $1) ]; /^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; /^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; @@ -325,6 +326,16 @@ EOF foreach my $target (@target) { $target->{subtarget} or print "\t\tdefault \"".$target->{board}."\" if TARGET_".$target->{conf}."\n"; } + print <{subtargets}} > 0; + print "\tdefault \"".$target->{cflags}."\" if TARGET_".$target->{conf}."\n"; + } + print "\tdefault \"-Os -pipe -funit-at-a-time\"\n"; my %kver; foreach my $target (@target) { @@ -332,8 +343,10 @@ EOF next if $kver{$v}; $kver{$v} = 1; print <