allow boards to customize compiler options on a per-file/dir basis
With our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_dir_lib_generic += -O2
Now all files under lib_generic/ will have -O2 appended to their build.
--- config.mk | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
config.mk +13 -6
@@ -206,23 +206,30 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### +# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) +cmd_compile.s.S = $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_dir_$(BCURDIR)) -o $@ $< +cmd_compile.o.S = $(CC) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_dir_$(BCURDIR)) -o $@ $< -c +cmd_compile.o.c = $(CC) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_dir_$(BCURDIR)) -o $@ $< -c + ifndef REMOTE_BUILD %.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(cmd_compile.s.S) %.o: %.S - $(CC) $(AFLAGS) -c -o $@ $< + $(cmd_compile.o.S) %.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(cmd_compile.o.c) else $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(cmd_compile.s.S) $(obj)%.o: %.S - $(CC) $(AFLAGS) -c -o $@ $< + $(cmd_compile.o.S) $(obj)%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(cmd_compile.o.c) + endif #########################################################################
Signature · 1 line
1.6.3
PATCH v2 1/1 allow boards to customize compiler options on a per-file/dir basis
With our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_lib_generic += -O2
Now all files under lib_generic/ will have -O2 appended to their build.
---
v2
- dont require dir_ since the naming is already unique (all objects have a ".o" suffix while dirs do not)
config.mk | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
config.mk +13 -6
@@ -206,23 +206,30 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### +# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) +cmd_compile.s.S = $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $< +cmd_compile.o.S = $(CC) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $< -c +cmd_compile.o.c = $(CC) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_$(BCURDIR)) -o $@ $< -c + ifndef REMOTE_BUILD %.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(cmd_compile.s.S) %.o: %.S - $(CC) $(AFLAGS) -c -o $@ $< + $(cmd_compile.o.S) %.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(cmd_compile.o.c) else $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(cmd_compile.s.S) $(obj)%.o: %.S - $(CC) $(AFLAGS) -c -o $@ $< + $(cmd_compile.o.S) $(obj)%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(cmd_compile.o.c) + endif #########################################################################
Signature · 1 line
1.6.3
PATCH v2 1/1 allow boards to customize compiler options on a per-file/dir basis
Quoted 11 lines · Mike Frysinger
With our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_lib_generic += -O2Now all files under lib_generic/ will have -O2 appended to their build.
Signed-off-by Mike Frysinger <[email protected]>---
Best Regards,
J.
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
In reply to Mike FrysingerWith our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_lib_generic += -O2
Now all files under lib_generic/ will have -O2 appended to their build.
---
v3
- updated to apply to next after Jean's changes
config.mk | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
config.mk +5 -3
@@ -206,11 +206,13 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### +# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $< $(obj)%.o: %.S - $(CC) $(AFLAGS) -c -o $@ $< + $(CC) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $< -c $(obj)%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_$(BCURDIR)) -o $@ $< -c #########################################################################
Signature · 1 line
1.6.3.1
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
Quoted 23 lines · Mike Frysinger
With our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_lib_generic += -O2Now all files under lib_generic/ will have -O2 appended to their build.
Signed-off-by Mike Frysinger <[email protected]>---
v3
- updated to apply to next after Jean's changesconfig.mk | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)config.mk +0
-0
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 8 lines
config.mk +3
-1@@ -206,11 +206,13 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### +# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<
we can drop this one as there is no obj %.s
Best Regards,
J.
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 7 lines · In message <[email protected]> you wrote:
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 6 lines
config.mk +3
-1+# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<we can drop this one as there is no obj %.s
But since it's already present it also makes sense to keep it, so we don;t have to figure out what it needs to be in case we have to add an assembler file later.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The greatest threat towards future is indifference.
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
Quoted 11 lines · Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 7 lines · In message <[email protected]> you wrote:
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 6 lines
config.mk +3
-1+# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<we can drop this one as there is no obj %.s
Quoted 3 lines
But since it's already present it also makes sense to keep it, so we don;t have to figure out what it needs to be in case we have to add an assembler file later.
the .s is supposed to be gcc temp file so It make sense to avoid it as assembly file suffix is .S for source
Best Regards,
J.
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
Quoted 12 lines · On Sunday 14 June 2009 11:10:08 Jean-Christophe PLAGNIOL-VILLARD wrote:
Quoted 11 lines · Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 7 lines · In message <[email protected]> you wrote:
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 5 lines
config.mk +3
-1+# Allow boards to use custom optimize flags on a per dir/file basis +BCURDIR := $(notdir $(CURDIR)) $(obj)%.s: %.S - $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<we can drop this one as there is no obj %.s
Quoted 5 lines
Quoted 3 lines
But since it's already present it also makes sense to keep it, so we don;t have to figure out what it needs to be in case we have to add an assembler file later.
the .s is supposed to be gcc temp file
not really. the .s file means "do not run preprocessor before sending to assembler". that is all.
Quoted 1 line
It make sense to avoid it as assembly file suffix is .S for source
usually, yes, but no need to force people to conform if they want to write pure assembly with no CPP stuff.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090614/23083ec4/attachment.pgp
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
In reply to Jean-Christophe PLAGNIOL-VILLARDDear Jean-Christophe PLAGNIOL-VILLARD,
Quoted 3 lines · In message <[email protected]> you wrote:
the .s is supposed to be gcc temp file so It make sense to avoid it as assembly file suffix is .S for source
That's not correct. ".s" has always (from the dawn of time) been normal assembler code in Unix systems. Normally you will use "as" directly on such files. ".S" is a suffix introduced much, much later and indicates files that need to be run through the C preprocessor.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Here's a fish hangs in the net like a poor man's right in the law. 'Twill hardly come out." - Shakespeare, Pericles, Act II, Scene 1
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 6 lines · On Sunday 14 June 2009 10:29:39 Jean-Christophe PLAGNIOL-VILLARD wrote:
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 3 lines · Mike Frysinger
$(obj)%.s: %.S
config.mk +1
-1- $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<we can drop this one as there is no obj %.s
looks to me like there is:
$ make lib_blackfin/memcmp.s bfin-uclinux-gcc -E -D__ASSEMBLY__ -g -Os -ffixed-P5 -fomit-frame-pointer -mno-fdpic -ffunction-sections -fdata-sections -mcpu=bf561-0.3 -D__KERNEL__ - I/usr/local/src/u-boot/blackfin/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/src/blackfin/toolchains/20090608/bfin- uclinux/lib/gcc/bfin-uclinux/4.3.3/include -pipe -DCONFIG_BLACKFIN -o lib_blackfin/memcmp.s lib_blackfin/memcmp.S
if that target is removed, this no longer works
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090614/cf281987/attachment.pgp
PATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
Quoted 8 lines · Mike Frysinger
Quoted 6 lines · On Sunday 14 June 2009 10:29:39 Jean-Christophe PLAGNIOL-VILLARD wrote:
config.mk export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS · line 212
Quoted 3 lines · Mike Frysinger
$(obj)%.s: %.S
config.mk +1
-1- $(CPP) $(AFLAGS) -o $@ $< + $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<we can drop this one as there is no obj %.s
Quoted 8 lines
looks to me like there is:
$ make lib_blackfin/memcmp.s bfin-uclinux-gcc -E -D__ASSEMBLY__ -g -Os -ffixed-P5 -fomit-frame-pointer -mno-fdpic -ffunction-sections -fdata-sections -mcpu=bf561-0.3 -D__KERNEL__ - I/usr/local/src/u-boot/blackfin/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/local/src/blackfin/toolchains/20090608/bfin- uclinux/lib/gcc/bfin-uclinux/4.3.3/include -pipe -DCONFIG_BLACKFIN -o lib_blackfin/memcmp.s lib_blackfin/memcmp.S
sorry for the miss I've done a find . -name Makefile | xargs grep "\.s" and miss it
Best Regards,
J.
Wolfgang Denk
AppliedPATCH v3 1/1 allow boards to customize compiler options on a per-file/dir basis
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 9 lines · In message <[email protected]> you wrote:
With our Blackfin boards, we like to build the compression routines with -O2 as our tests show a pretty good size/speed tradeoff. For the rest of U-Boot though, we want to stick with the default -Os as that is mostly control code. So in our case, we would add a line like so to the board specific config.mk file:
CFLAGS_lib_generic += -O2Now all files under lib_generic/ will have -O2 appended to their build.
Quoted 8 lines
Signed-off-by Mike Frysinger <[email protected]>---
v3
- updated to apply to next after Jean's changesconfig.mk | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm a programmer: I don't buy software, I write it.
-- Tom Christiansen