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
This commit is contained in:
Dominik Riebeling 2013-05-11 11:28:08 +02:00
parent 440872bb42
commit 8a4075d454
3 changed files with 3 additions and 10 deletions

View file

@ -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 $@ $<