[U-Boot] [PATCH v3 02/20] Change directory-specific CFLAGS to use full path
Peter Tyser
ptyser at xes-inc.com
Sun Apr 11 19:26:57 CEST 2010
Previously, a specific file or directory could be compiled with custom
CFLAGS by adding a Makefile variable such as:
CFLAGS_dlmalloc.o = <custom flags for common/dlmalloc.c>
or
CFLAGS_lib = <custom flags for lib directory>
This method breaks down once multiple files or directories share the
same path. Eg FLAGS_fileA = <custom flags> would incorrectly result in
both dir1/fileA.c and dir2/fileA.c being compiled with <custom flags>.
This change allows finer grained control which we need once we move
lib_$ARCH to arch/$ARCH/lib/ and lib_generic/ to lib/. Without this
change all lib/ directories would share the same custom CFLAGS.
Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
board/bf518f-ezbrd/config.mk | 2 +-
board/bf526-ezbrd/config.mk | 2 +-
board/bf527-ezkit/config.mk | 2 +-
board/bf533-ezkit/config.mk | 2 +-
board/bf533-stamp/config.mk | 2 +-
board/bf537-stamp/config.mk | 2 +-
board/bf538f-ezkit/config.mk | 2 +-
board/bf548-ezkit/config.mk | 2 +-
board/bf561-acvilon/config.mk | 2 +-
board/bf561-ezkit/config.mk | 2 +-
board/cm-bf527/config.mk | 2 +-
board/cm-bf533/config.mk | 2 +-
board/cm-bf537e/config.mk | 2 +-
board/cm-bf537u/config.mk | 2 +-
board/cm-bf548/config.mk | 2 +-
board/cm-bf561/config.mk | 2 +-
board/eNET/config.mk | 2 +-
board/tcm-bf518/config.mk | 2 +-
board/tcm-bf537/config.mk | 2 +-
config.mk | 17 +++++++++++------
20 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/board/bf518f-ezbrd/config.mk b/board/bf518f-ezbrd/config.mk
index f85bef5..fb93531 100644
--- a/board/bf518f-ezbrd/config.mk
+++ b/board/bf518f-ezbrd/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
diff --git a/board/bf526-ezbrd/config.mk b/board/bf526-ezbrd/config.mk
index f85bef5..fb93531 100644
--- a/board/bf526-ezbrd/config.mk
+++ b/board/bf526-ezbrd/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
diff --git a/board/bf527-ezkit/config.mk b/board/bf527-ezkit/config.mk
index f85bef5..fb93531 100644
--- a/board/bf527-ezkit/config.mk
+++ b/board/bf527-ezkit/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
diff --git a/board/bf533-ezkit/config.mk b/board/bf533-ezkit/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/bf533-ezkit/config.mk
+++ b/board/bf533-ezkit/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf533-stamp/config.mk b/board/bf533-stamp/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/bf533-stamp/config.mk
+++ b/board/bf533-stamp/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf537-stamp/config.mk b/board/bf537-stamp/config.mk
index bc14257..95d0fcc 100644
--- a/board/bf537-stamp/config.mk
+++ b/board/bf537-stamp/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf538f-ezkit/config.mk b/board/bf538f-ezkit/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/bf538f-ezkit/config.mk
+++ b/board/bf538f-ezkit/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/bf548-ezkit/config.mk b/board/bf548-ezkit/config.mk
index 42ff946..aff12e9 100644
--- a/board/bf548-ezkit/config.mk
+++ b/board/bf548-ezkit/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --dma 6
diff --git a/board/bf561-acvilon/config.mk b/board/bf561-acvilon/config.mk
index cfad21a..b517025 100644
--- a/board/bf561-acvilon/config.mk
+++ b/board/bf561-acvilon/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/bf561-ezkit/config.mk b/board/bf561-ezkit/config.mk
index cfad21a..b517025 100644
--- a/board/bf561-ezkit/config.mk
+++ b/board/bf561-ezkit/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/cm-bf527/config.mk b/board/cm-bf527/config.mk
index f85bef5..fb93531 100644
--- a/board/cm-bf527/config.mk
+++ b/board/cm-bf527/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
diff --git a/board/cm-bf533/config.mk b/board/cm-bf533/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/cm-bf533/config.mk
+++ b/board/cm-bf533/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf537e/config.mk b/board/cm-bf537e/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/cm-bf537e/config.mk
+++ b/board/cm-bf537e/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf537u/config.mk b/board/cm-bf537u/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/cm-bf537u/config.mk
+++ b/board/cm-bf537u/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/board/cm-bf548/config.mk b/board/cm-bf548/config.mk
index 0c95b39..66c7368 100644
--- a/board/cm-bf548/config.mk
+++ b/board/cm-bf548/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --dma 6
diff --git a/board/cm-bf561/config.mk b/board/cm-bf561/config.mk
index cfad21a..b517025 100644
--- a/board/cm-bf561/config.mk
+++ b/board/cm-bf561/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16
diff --git a/board/eNET/config.mk b/board/eNET/config.mk
index 5c64804..dcde7fc 100644
--- a/board/eNET/config.mk
+++ b/board/eNET/config.mk
@@ -22,7 +22,7 @@
#
TEXT_BASE = 0x38040000
-CFLAGS_dlmalloc.o += -Wa,--no-warn -fno-strict-aliasing
+CFLAGS_common/dlmalloc.o += -Wa,--no-warn -fno-strict-aliasing
PLATFORM_RELFLAGS += -fvisibility=hidden
PLATFORM_CPPFLAGS += -fno-dwarf2-cfi-asm
PLATFORM_LDFLAGS += -pic --emit-relocs -Bsymbolic -Bsymbolic-functions
diff --git a/board/tcm-bf518/config.mk b/board/tcm-bf518/config.mk
index f85bef5..fb93531 100644
--- a/board/tcm-bf518/config.mk
+++ b/board/tcm-bf518/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
diff --git a/board/tcm-bf537/config.mk b/board/tcm-bf537/config.mk
index 3c0b46f..b50e1f2 100644
--- a/board/tcm-bf537/config.mk
+++ b/board/tcm-bf537/config.mk
@@ -27,7 +27,7 @@
#TEXT_BASE = do-not-use-me
CFLAGS_lib_generic += -O2
-CFLAGS_lzma += -O2
+CFLAGS_lib_generic/lzma += -O2
# Set some default LDR flags based on boot mode.
LDR_FLAGS-BFIN_BOOT_PARA := --bits 16 --dma 8
diff --git a/config.mk b/config.mk
index ee9ca28..93046a9 100644
--- a/config.mk
+++ b/config.mk
@@ -236,16 +236,21 @@ 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))
+BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%))
$(obj)%.s: %.S
- $(CPP) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $<
+ $(CPP) $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) \
+ -o $@ $<
$(obj)%.o: %.S
- $(CC) $(AFLAGS) $(AFLAGS_$(@F)) $(AFLAGS_$(BCURDIR)) -o $@ $< -c
+ $(CC) $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) \
+ -o $@ $< -c
$(obj)%.o: %.c
- $(CC) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_$(BCURDIR)) -o $@ $< -c
+ $(CC) $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
+ -o $@ $< -c
$(obj)%.i: %.c
- $(CPP) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_$(BCURDIR)) -o $@ $< -c
+ $(CPP) $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
+ -o $@ $< -c
$(obj)%.s: %.c
- $(CC) $(CFLAGS) $(CFLAGS_$(@F)) $(CFLAGS_$(BCURDIR)) -o $@ $< -c -S
+ $(CC) $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
+ -o $@ $< -c -S
#########################################################################
--
1.6.2.1
More information about the U-Boot
mailing list