From 720a9b4609cb8d5740bbe92b313098d5e5481fe8 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Tue, 5 Sep 2023 12:51:24 +0200 Subject: [PATCH] Makefile - Handle .d files correctly --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f7ed379..9ac90fc 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,17 @@ +.DEFAULT_GOAL: all + include Makeconf # Auto tracking of headers CXX_FLAGS += -MMD -depfiles := $(wildcard *.d **/*.d) -clean-objs := $(TARGETS) $(foreach t,$(TARGETS),$(modules_$(t))) $(depfiles) +all-modules := $(foreach t,$(TARGETS),$(modules_$(t))) + +depfiles := $(patsubst %.o,%.d,$(filter %.o,$(all-modules))) + +-include $(depfiles) + +clean-objs := $(TARGETS) $(all-modules) $(depfiles) cmd = $(VERBOSE)g++ $(CXX_FLAGS) -o $@ $^ msg = $(or $(verb_$@),finalize) $@