summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-11 11:28:08 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-11 20:34:11 +0200
commit8a4075d454a64cc51ea7e496f346fd96d5970eff (patch)
treef0702978f4d1bb2bae64da8e75a7acabece90a68
parent440872bb4277c882ece20339fa4b2525c1c4ed2a (diff)
downloadrockbox-8a4075d454a64cc51ea7e496f346fd96d5970eff.zip
rockbox-8a4075d454a64cc51ea7e496f346fd96d5970eff.tar.gz
rockbox-8a4075d454a64cc51ea7e496f346fd96d5970eff.tar.bz2
rockbox-8a4075d454a64cc51ea7e496f346fd96d5970eff.tar.xz
Make libtools compile rule more generic.
Create the object - source dependency internally and use a more generic rule for compiling. Removes the need for explicit rules for source files located in a different folder. This adds the limitation for SOURCES and LIBSOURCES to only hold C files. Change-Id: I56f6a4b1e7df36347cd2f54051e072251f456092
-rw-r--r--rbutil/libtools.make4
-rw-r--r--rbutil/mkimxboot/Makefile4
-rw-r--r--rbutil/mktccboot/Makefile5
3 files changed, 3 insertions, 10 deletions
diff --git a/rbutil/libtools.make b/rbutil/libtools.make
index 59be99f..2e3cc6f 100644
--- a/rbutil/libtools.make
+++ b/rbutil/libtools.make
@@ -80,6 +80,8 @@ all: $(BINARY)
OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(notdir $(SOURCES))))
LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(notdir $(LIBSOURCES))))
+$(foreach src,$(SOURCES) $(LIBSOURCES),$(eval $(addprefix $(OBJDIR),$(subst .c,.o,$(notdir $(src)))): $(src)))
+
# additional link dependencies for the standalone executable
# extra dependencies: libucl
LIBUCL = libucl$(RBARCH).a
@@ -98,7 +100,7 @@ $(BINARY): $(OBJS) $(EXTRADEPS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS))
$(addprefix $(OBJDIR),$(EXTRALIBOBJS))
# common rules
-$(OBJDIR)%.o: %.c
+$(OBJDIR)%.o:
@echo CC $<
$(SILENT)mkdir -p $(dir $@)
$(SILENT)$(CROSS)$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/rbutil/mkimxboot/Makefile b/rbutil/mkimxboot/Makefile
index a81b960..acfe8de 100644
--- a/rbutil/mkimxboot/Makefile
+++ b/rbutil/mkimxboot/Makefile
@@ -27,7 +27,3 @@ include ../libtools.make
$(OBJDIR)mkimxboot.o: dualboot.h dualboot.c mkimxboot.c mkimxboot.h
$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkimxboot.h
-$(OBJDIR)%.o: $(IMXTOOLS_DIR)%.c
- @echo CC $<
- $(SILENT)mkdir -p $(dir $@)
- $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/rbutil/mktccboot/Makefile b/rbutil/mktccboot/Makefile
index 31ad68e..df49c69 100644
--- a/rbutil/mktccboot/Makefile
+++ b/rbutil/mktccboot/Makefile
@@ -25,9 +25,4 @@ include ../libtools.make
# Rules go _after_ including mkboot.make to have OBJDIR set up correctly.
# Paths are assumed to end with a /
telechips.o: $(OBJDIR)telechips.o
-$(OBJDIR)%.o: $(TOOLSDIR)%.c
- @echo CC $<
- $(SILENT)mkdir -p $(dir $@)
- $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c -o $@ $<
-