From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Mon, 18 May 2009 03:06:04 -0400 Subject: [U-Boot] [RFC/PATCH v2] allow boards to customize compiler options on a per-file/dir basis In-Reply-To: <1242629780-2081-1-git-send-email-vapier@gentoo.org> References: <1242629780-2081-1-git-send-email-vapier@gentoo.org> Message-ID: <1242630364-2510-1-git-send-email-vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. Signed-off-by: Mike Frysinger --- 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(-) diff --git a/config.mk b/config.mk index b1254e9..c3a787a 100644 --- a/config.mk +++ b/config.mk @@ -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 ######################################################################### -- 1.6.3