summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-12-25 09:19:16 +0000
committertron <tron@openttd.org>2005-12-25 09:19:16 +0000
commit0e12ad7d99a2263338c7a041e209bb2dfa8e38bf (patch)
tree943a4a52059c2ff13cc18b714a480d3b684523f2 /Makefile
parent04c096ee63719c09e839131ea0d692b8dbd5815d (diff)
downloadopenttd-0e12ad7d99a2263338c7a041e209bb2dfa8e38bf.tar.xz
(svn r3340) Fix dependency calculation: dependencies didn't get recalculated if a header file changed
Also really automagically create the dependency directories by deriving the directory names from $(DEPS)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 14 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 3f3ed1ca1..76d9a66d8 100644
--- a/Makefile
+++ b/Makefile
@@ -978,26 +978,31 @@ upgradeconf: $(MAKE_CONFIG)
### Internal build rules
# This makes sure the .deps dir is always around.
-DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx .deps/ai/default .deps/ai/trolly)
+DEPS_MAGIC := $(shell mkdir -p $(sort $(dir $(DEPS))))
+
+depend:
+ @true # The include handles this automagically
# Introduce the dependencies
-ifneq ($(MAKECMDGOALS), clean)
+ifeq ($(findstring $(MAKECMDGOALS), clean info),)
-include $(DEPS)
endif
-%.o: .deps/%.d
+# Silence stale header dependency errors
+%.h:
+ @true
.deps/%.d: %.c $(MAKE_CONFIG) table/strings.h endian_target.h
- @echo '===> Determining dependencies of $<'
- $(Q)$(CC) $(CFLAGS) $(CDEFS) -MM $< > $@
+ @echo '===> DEP $<'
+ $(Q)$(CC) $(CFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
.deps/%.d: %.cpp $(MAKE_CONFIG) table/strings.h endian_target.h
- @echo '===> Determining dependencies of $<'
- $(Q)$(CXX) $(CFLAGS) $(CDEFS) -MM $< > $@
+ @echo '===> DEP $<'
+ $(Q)$(CXX) $(CXXFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
.deps/%.d: %.m $(MAKE_CONFIG) table/strings.h endian_target.h
- @echo '===> Determining dependencies of $<'
- $(Q)$(CC) $(CFLAGS) $(CDEFS) -MM $< > $@
+ @echo '===> DEP $<'
+ $(Q)$(CC) $(OBJCFLAGS) -MM $< | sed 's#^$(@F:%.d=%.o):#$@ $(@:.deps/%.d=%.o):#' > $@
%.o: %.c $(MAKE_CONFIG)