[conf] fix/improve dependecy generation

This commit is contained in:
Felix Ruess
2013-11-01 18:38:53 +01:00
parent 84cf87cfa5
commit 8807918668
7 changed files with 63 additions and 56 deletions
+10 -8
View File
@@ -83,7 +83,11 @@ $(TARGET).srcsnd = $(notdir $($(TARGET).srcs))
$(TARGET).objso = $($(TARGET).srcs:%.c=$(OBJDIR)/%.o)
$(TARGET).objs = $($(TARGET).objso:%.S=$(OBJDIR)/%.o)
all compile: $(OBJDIR)/simsitl
all compile: $(OBJDIR) $(OBJDIR)/simsitl
$(OBJDIR):
@echo CREATING object dir $(OBJDIR)
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
# shared library of the C autopilot part
autopilot.so : $($(TARGET).objs)
@@ -125,23 +129,21 @@ $(OBJDIR)/%.s: %.cpp
$(OBJDIR)/%.o: %.c $(OBJDIR)/../Makefile.ac
@echo CC $@
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
$(Q)$(CC) -MMD $(CFLAGS) -c -o $@ $<
$(OBJDIR)/%.o: %.cpp $(OBJDIR)/../Makefile.ac
@echo CC $@
$(Q)test -d $(dir $@) || mkdir -p $(dir $@)
$(Q)$(CC) $(CFLAGS) -c -o $@ $<
$(Q)$(CC) -MMD $(CFLAGS) -c -o $@ $<
.PHONY: all compile
#
# Dependencies
#
$(OBJDIR)/.depend:
@test -d $(OBJDIR) || mkdir -p $(OBJDIR)
@echo DEPEND $@
$(Q)$(CC) -MM -MG $(CFLAGS) $($(TARGET).srcs) | sed 's|\([^\.]*\.o\)|$(OBJDIR)/\1|' > $@
DEPS = $(addprefix $(OBJDIR)/,$($(TARGET).srcs:.c=.d))
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJDIR)/.depend
-include $(DEPS)
endif