diff --git a/benchmarks/Makefile b/benchmarks/Makefile index a3743bf..c607b1f 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -21,7 +21,7 @@ override LDFLAGS := $(BENCH_LDFLAGS) $(LDFLAGS) $(O_DIR)/latmus: override CFLAGS := -I zephyr/latmon/src $(CFLAGS) -all: output-Makefile $(TARGETS) +all: output-Makefile $(DEPFILES) $(TARGETS) install: all $(call inst-cmd,benchmarks,$(Q)for bin in $(BINARIES); do \ @@ -31,7 +31,7 @@ install: all clean clobber mrproper: output-Makefile $(Q)$(RM) -f $(TARGETS) $(DEPFILES) -$(O_DIR)/%: %.c +$(O_DIR)/%: %.c $(O_DIR)/%.d $(call ccld-cmd,$@,$(Q)$(CC) -o $(@) $< $(CFLAGS) $(LDFLAGS)) -include $(DEPFILES) diff --git a/config.mk b/config.mk index 967bb5e..2347c52 100644 --- a/config.mk +++ b/config.mk @@ -28,7 +28,7 @@ bindir ?= bin testdir ?= tests libexecdir ?= libexec -export ARCH CROSS_COMPILE CC LD AR UAPI CFLAGS LDFLAGS DESTDIR +export ARCH CROSS_COMPILE CC CXX LD AR UAPI CFLAGS LDFLAGS DESTDIR MAKEFLAGS += -rR @@ -100,6 +100,9 @@ $(TARGETS): $(O_DIR)/%.d: %.c $(call dep-cmd,$@,@$(CC) -MM $(CFLAGS) $< | sed 's$(comma)\($*\)\.o[ :]*$(comma)$(O_DIR)/\1.o $@: $(comma)g' > $@ || rm -f $@) +$(O_DIR)/%.d: %.cc + $(call dep-cmd,$@,@$(CXX) -MM $(CXXFLAGS) $< | sed 's$(comma)\($*\)\.o[ :]*$(comma)$(O_DIR)/\1.o $@: $(comma)g' > $@ || rm -f $@) + define MAKEFLY = # Automatically generated: do not edit diff --git a/eshi/Makefile b/eshi/Makefile index db53eea..79030d7 100644 --- a/eshi/Makefile +++ b/eshi/Makefile @@ -26,7 +26,7 @@ override CFLAGS := $(LIB_CFLAGS) $(CFLAGS) override LDFLAGS := $(LDFLAGS) -lpthread -lrt -all: output-Makefile $(TARGETS) +all: output-Makefile $(DEPFILES) $(TARGETS) install: all $(call inst-cmd,$(SOLIBNAME),$(INSTALL) -D $(O_DIR)/$(SOLIBNAME) -t $(DESTDIR)/$(libdir)) @@ -49,10 +49,10 @@ $(O_DIR)/$(ARLIBNAME): $(OBJFILES) $(O_DIR)/version-pic.o $(O_DIR)/version.o: override CFLAGS := $(CFLAGS) -DLIBSERIAL=\"$(EVL_SERIAL)\" version.c: $(O_DIR)/git-stamp.h -$(O_DIR)/%-pic.o: %.c +$(O_DIR)/%-pic.o: %.c $(O_DIR)/%.d $(call cc-pic-cmd,$@,$(CC) $(CFLAGS) -fPIC -c -o $@ $<) -$(O_DIR)/%.o: %.c +$(O_DIR)/%.o: %.c $(O_DIR)/%.d $(call cc-cmd,$@,$(CC) $(CFLAGS) -c -o $@ $<) -include $(DEPFILES) diff --git a/lib/Makefile b/lib/Makefile index fb1fcb8..400e182 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -27,7 +27,7 @@ override CFLAGS := $(LIB_CFLAGS) $(CFLAGS) override LDFLAGS := $(LDFLAGS) -lpthread -lrt -all: output-Makefile $(TARGETS) +all: output-Makefile $(DEPFILES) $(TARGETS) install: all $(call inst-cmd,$(SOLIBNAME),$(INSTALL) -D $(O_DIR)/$(SOLIBNAME) -t $(DESTDIR)/$(libdir)) @@ -52,10 +52,10 @@ $(O_DIR)/syscall-pic.o $(O_DIR)/syscall.o: override CFLAGS := $(CFLAGS) -fomit-f $(O_DIR)/version-pic.o $(O_DIR)/version.o: override CFLAGS := $(CFLAGS) -DLIBSERIAL=\"$(EVL_SERIAL)\" version.c: $(O_DIR)/git-stamp.h -$(O_DIR)/%-pic.o: %.c +$(O_DIR)/%-pic.o: %.c $(O_DIR)/%.d $(call cc-pic-cmd,$@,$(CC) $(CFLAGS) -fPIC -c -o $@ $<) -$(O_DIR)/%.o: %.c +$(O_DIR)/%.o: %.c $(O_DIR)/%.d $(call cc-cmd,$@,$(CC) $(CFLAGS) -c -o $@ $<) -include $(DEPFILES) diff --git a/tests/Makefile b/tests/Makefile index 37f8d7d..11a04e4 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -33,7 +33,8 @@ ESHI_CPPFLAGS := $(BASE_CPPFLAGS) \ -I$(O_DIR)/../include ESHI_CFLAGS := $(ESHI_CPPFLAGS) $(BASE_CFLAGS) -all: output-Makefile $(TARGETS) +all: output-Makefile $(DEPFILES) $(TARGETS) + $(Q)$(MAKE) -C compile-tests O=$(O_DIR)/compile-tests V=$(V) $@ || exit 1 $(TARGETS): $(HELPOBJ) $(HELPOBJ_ESHI) @@ -51,13 +52,13 @@ clean clobber mrproper: $(HELPOBJ_ESHI): $(HELPSRC) $(call cc-cmd,$@,$(Q)$(CC) -o $(@) $< -c $(ESHI_CFLAGS)) -$(O_DIR)/%.o: %.c +$(O_DIR)/%.o: %.c $(O_DIR)/%.d $(call cc-cmd,$@,$(Q)$(CC) -o $(@) $< -c $(CFLAGS)) -$(O_DIR)/%: %.c +$(O_DIR)/%: %.c $(O_DIR)/%.d $(call ccld-cmd,$@,$(Q)$(CC) -o $(@) $< $(HELPOBJ) $(TEST_CFLAGS) $(TEST_LDFLAGS)) -$(O_DIR)/%.eshi: %.c +$(O_DIR)/%.eshi: %.c $(O_DIR)/%.d $(call ccld-cmd,$@,$(Q)$(CC) -o $(@) $< $(HELPOBJ_ESHI) $(ESHI_CFLAGS) $(ESHI_LDFLAGS)) -include $(DEPFILES) diff --git a/utils/Makefile b/utils/Makefile index 25454b7..92f6f05 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -25,7 +25,7 @@ override LDFLAGS := $(CMD_LDFLAGS) $(LDFLAGS) $(TARGETS): -all: output-Makefile $(TARGETS) +all: output-Makefile $(DEPFILES) $(TARGETS) install: all $(call inst-cmd,utilities, \ @@ -40,7 +40,7 @@ install: all clean clobber mrproper: output-Makefile $(Q)$(RM) -f $(TARGETS) $(DEPFILES) -$(O_DIR)/%: %.c +$(O_DIR)/%: %.c $(O_DIR)/%.d $(call ccld-cmd,$@,$(Q)$(CC) -o $(@) $< $(CFLAGS) $(LDFLAGS)) -include $(DEPFILES)