From 89f39e177e7b0152aa1d3152baa25d986e36cdcf Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 12 Apr 2010 22:28:03 -0500 Subject: Change directory-specific CFLAGS to use full path Previously, a specific file or directory could be compiled with custom CFLAGS by adding a Makefile variable such as: CFLAGS_dlmalloc.o = or CFLAGS_lib = This method breaks down once multiple files or directories share the same path. Eg FLAGS_fileA = would incorrectly result in both dir1/fileA.c and dir2/fileA.c being compiled with . 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 --- config.mk | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'config.mk') diff --git a/config.mk b/config.mk index c82cb63d24..1a61dbb7fa 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 ######################################################################### -- cgit v1.2.3