diff --git a/compile.mk b/compile.mk index 57533f01..2891b7b1 100644 --- a/compile.mk +++ b/compile.mk @@ -43,8 +43,8 @@ CXXFLAGS += $(FLAGS) # Derive object files from sources and place them before user-defined objects -OBJECTS := $(patsubst %, build/%.o, $(SOURCES)) $(OBJECTS) -DEPS := $(patsubst %, build/%.d, $(SOURCES)) +OBJECTS += $(patsubst %, build/%.o, $(SOURCES)) +DEPENDENCIES := $(patsubst %, build/%.d, $(SOURCES)) # Final targets @@ -52,7 +52,7 @@ DEPS := $(patsubst %, build/%.d, $(SOURCES)) $(TARGET): $(RESOURCES) $(OBJECTS) $(CXX) -o $@ $(OBJECTS) $(LDFLAGS) --include $(DEPS) +-include $(DEPENDENCIES) build/%.c.o: %.c @mkdir -p $(@D) diff --git a/dep.mk b/dep.mk index 9a5e1d0a..8c462830 100644 --- a/dep.mk +++ b/dep.mk @@ -22,7 +22,6 @@ else CMAKE := cmake -DCMAKE_INSTALL_PREFIX="$(realpath $(DEP_LOCAL))" endif - # Export environment for all dependency targets $(DEPS): export CFLAGS = $(DEP_CFLAGS) $(DEPS): export CXXFLAGS = $(DEP_CXXFLAGS)