From f15abc24d2c9a574d1209922a0d9825df21245f8 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 22 Sep 2011 23:04:07 -0700 Subject: [PATCH] Makefile: Fix automatic generation of dependencies. Without this, updates to the header file were not triggering rebuilds of the source. Things are much more convenient with this. --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a5e8015..a00d6bf 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: scherzo -scherzo_srcs = \ +scherzo_srcs := \ scherzo.c \ score.c @@ -25,16 +25,16 @@ endif # Otherwise, print the full command line. quiet ?= $($(shell echo $1 | sed -e s'/ .*//')) -.deps/%.d: %.cpp $(global_deps) +.deps/%.d: %.c Makefile @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ - $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \ + $(CC) -M $(CPPFLAGS) $(SCHERZO_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \ sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ -DEPS := $(DEPS:%.cpp=.deps/%.d) +DEPS := $(scherzo_srcs:%.c=.deps/%.d) -include $(DEPS) -%.o: %.c $(global_deps) +%.o: %.c Makefile $(call quiet,CC $(CFLAGS)) -c $(SCHERZO_CFLAGS) $< -o $@ scherzo: $(scherzo_modules) -- 2.43.0