All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC/PATCH] allow boards to customize compiler options on a per-file/dir basis
Date: Mon, 18 May 2009 02:56:20 -0400	[thread overview]
Message-ID: <1242629780-2081-1-git-send-email-vapier@gentoo.org> (raw)

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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 config.mk |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/config.mk b/config.mk
index b1254e9..5d442b5 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_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
 
 #########################################################################
-- 
1.6.3

             reply	other threads:[~2009-05-18  6:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18  6:56 Mike Frysinger [this message]
2009-05-18  7:06 ` [U-Boot] [RFC/PATCH v2] allow boards to customize compiler options on a per-file/dir basis Mike Frysinger
2009-06-09 18:17   ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-14 13:33   ` [U-Boot] [PATCH/next v3] " Mike Frysinger
2009-06-14 14:29     ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-14 14:45       ` Wolfgang Denk
2009-06-14 15:10         ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-14 15:32           ` Mike Frysinger
2009-06-14 18:24           ` Wolfgang Denk
2009-06-14 14:56       ` Mike Frysinger
2009-06-14 15:08         ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-14 20:44     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1242629780-2081-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.