diff --git a/compile.mk b/compile.mk index 58ddc082..22b4899f 100644 --- a/compile.mk +++ b/compile.mk @@ -43,13 +43,13 @@ CXXFLAGS += $(FLAGS) # Derive object files from sources and place them before user-defined objects -OBJECTS += $(patsubst %, build/%.o, $(SOURCES)) +SOURCE_OBJECTS := $(patsubst %, build/%.o, $(SOURCES)) DEPENDENCIES := $(patsubst %, build/%.d, $(SOURCES)) # Final targets -$(TARGET): $(OBJECTS) - $(CXX) -o $@ $(OBJECTS) $(LDFLAGS) +$(TARGET): $(SOURCE_OBJECTS) $(OBJECTS) + $(CXX) -o $@ $^ $(LDFLAGS) -include $(DEPENDENCIES)