From 8a4075d454a64cc51ea7e496f346fd96d5970eff Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 11 May 2013 11:28:08 +0200 Subject: [PATCH] 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 --- rbutil/libtools.make | 4 +++- rbutil/mkimxboot/Makefile | 4 ---- rbutil/mktccboot/Makefile | 5 ----- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/rbutil/libtools.make b/rbutil/libtools.make index 59be99f76b..2e3cc6f1e2 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 a81b960649..acfe8de6bb 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 31ad68e643..df49c6977d 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 $@ $< -