mirror of https://github.com/OpenTTD/OpenTTD
(svn r1672) Simplify dependency tracking and actually implement it for C++ files, too.
Note: Do "make clean" to get rid of the old dependency filesrelease/0.4.5
parent
85248d7850
commit
6497f08ad4
20
Makefile
20
Makefile
|
@ -667,8 +667,7 @@ ifdef WITH_DIRECTMUSIC
|
||||||
CXX_SOURCES += w32dm2.cpp
|
CXX_SOURCES += w32dm2.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEPS1 = $(foreach obj,$(OBJS),.deps/$(obj))
|
DEPS = $(OBJS:%.o=.deps/%.d)
|
||||||
DEPS = $(DEPS1:%.o=%.P)
|
|
||||||
|
|
||||||
LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt))
|
LANG_TXT = $(filter-out %.unfinished.txt,$(wildcard lang/*.txt))
|
||||||
LANGS = $(LANG_TXT:%.txt=%.lng)
|
LANGS = $(LANG_TXT:%.txt=%.lng)
|
||||||
|
@ -912,20 +911,19 @@ DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||||
# first compilation round as we just build everything at that time anyway,
|
# first compilation round as we just build everything at that time anyway,
|
||||||
# therefore we do not need to watch deps.
|
# therefore we do not need to watch deps.
|
||||||
|
|
||||||
|
|
||||||
%.o: %.c $(MAKE_CONFIG) endian.h table/strings.h
|
%.o: %.c $(MAKE_CONFIG) endian.h table/strings.h
|
||||||
@echo '===> Compiling $<'
|
@echo '===> Compiling $<'
|
||||||
@$(CC) $(CFLAGS) $(CDEFS) -Wp,-MD,.deps/$(*F).pp -c $< -o $@
|
@$(CC) $(CFLAGS) $(CDEFS) -MD -c $< -o $@
|
||||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
@mv $(<:%.c=%.d) $(<:%.c=.deps/%.d)
|
||||||
tr ' ' '\012' < .deps/$(*F).pp \
|
|
||||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
|
||||||
>> .deps/$(*F).P; \
|
|
||||||
rm .deps/$(*F).pp
|
|
||||||
|
|
||||||
# For DirectMusic build and BeOS specific parts
|
|
||||||
%.o: %.cpp $(MAKE_CONFIG) endian.h table/strings.h
|
%.o: %.cpp $(MAKE_CONFIG) endian.h table/strings.h
|
||||||
@echo '===> Compiling $<'
|
@echo '===> Compiling $<'
|
||||||
@$(CXX) $(CFLAGS) $(CDEFS) -c $< -o $@
|
@$(CXX) $(CFLAGS) $(CDEFS) -MD -c $< -o $@
|
||||||
|
@mv $(<:%.c=%.d) $(<:%.c=.deps/%.d)
|
||||||
|
|
||||||
|
# Silence stale header dependencies
|
||||||
|
%.h:
|
||||||
|
@true
|
||||||
|
|
||||||
|
|
||||||
info:
|
info:
|
||||||
|
|
Loading…
Reference in New Issue