summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-03-14 03:17:06 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-03-14 03:17:06 +0000
commit3ce8595b78fb95bfbfda8123d69c6e3494ec9bab (patch)
tree6c94165b9cfec5329ff554b23efbaa04b1d7bb86
parentdce670f0f96f4c43d486b51da053585f0d88112f (diff)
move cflags default setting to target makefiles
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14866 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--include/target.mk8
-rw-r--r--rules.mk1
-rwxr-xr-xscripts/metadata.pl13
-rw-r--r--target/linux/ar71xx/Makefile1
-rw-r--r--target/linux/storm/Makefile1
-rw-r--r--toolchain/Config.in11
6 files changed, 25 insertions, 10 deletions
diff --git a/include/target.mk b/include/target.mk
index ace3db0ff..5d8baeaeb 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 96ae8d57f..dad7456a6 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 7496f33a7..400255900 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 <<EOF;
+
+config DEFAULT_TARGET_OPTIMIZATION
+ string
+EOF
+ foreach my $target (@target) {
+ next if @{$target->{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 <<EOF;
+
config LINUX_$v
bool
+
EOF
}
foreach my $def (sort keys %defaults) {
diff --git a/target/linux/ar71xx/Makefile b/target/linux/ar71xx/Makefile
index 948c4615c..07792ffdd 100644
--- a/target/linux/ar71xx/Makefile
+++ b/target/linux/ar71xx/Makefile
@@ -10,6 +10,7 @@ ARCH:=mips
BOARD:=ar71xx
BOARDNAME:=Atheros AR71xx/AR913x
FEATURES:=squashfs tgz
+CFLAGS:=-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time
LINUX_VERSION:=2.6.28.7
diff --git a/target/linux/storm/Makefile b/target/linux/storm/Makefile
index abd6b0cc3..6138feb23 100644
--- a/target/linux/storm/Makefile
+++ b/target/linux/storm/Makefile
@@ -10,6 +10,7 @@ ARCH:=arm
BOARD:=storm
BOARDNAME:=Storm SL3512
FEATURES:=squashfs pci broken
+CFLAGS:=-Os -pipe -march=armv4 -mtune=arm9tdmi -funit-at-a-time
LINUX_VERSION:=2.6.23.17
diff --git a/toolchain/Config.in b/toolchain/Config.in
index ab684bb57..479e6dcaf 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -104,16 +104,7 @@ config SOFT_FLOAT
config TARGET_OPTIMIZATION
string
prompt "Target Optimizations" if TOOLCHAINOPTS
- default "-O2 -pipe -march=i686 -funit-at-a-time" if TARGET_x86_mediacenter
- default "-O2 -pipe -march=i486 -funit-at-a-time" if TARGET_x86
- default "-Os -pipe -march=i486 -funit-at-a-time" if TARGET_rdc
- default "-Os -pipe -march=i486 -funit-at-a-time" if TARGET_uml && i386
- default "-Os -pipe -march=athlon64 -funit-at-a-time" if TARGET_uml && x86_64
- default "-Os -pipe -mips32r2 -mtune=mips32r2 -funit-at-a-time" if TARGET_ar71xx
- default "-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time" if mipsel || mips
- default "-Os -pipe -march=armv5te -mtune=xscale -funit-at-a-time" if TARGET_ixp4xx || TARGET_iop32x || TARGET_pxa || TARGET_orion
- default "-Os -pipe -march=armv4 -mtune=arm9tdmi -funit-at-a-time" if TARGET_storm
- default "-Os -pipe -funit-at-a-time"
+ default DEFAULT_TARGET_OPTIMIZATION
help
Optimizations to use when building for the target host.