mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r2841) Pimp the Makefile: Determining the header dependencies is now a separate step.
This should fix the dependency related problems and reduce the number of recompiled files when table/strings.h changes
This commit is contained in:
parent
7cca146b0a
commit
69eb13c504
78
Makefile
78
Makefile
@ -453,7 +453,7 @@ endif
|
|||||||
# libpng config
|
# libpng config
|
||||||
ifdef WITH_PNG
|
ifdef WITH_PNG
|
||||||
CDEFS += -DWITH_PNG
|
CDEFS += -DWITH_PNG
|
||||||
CFLAGS += $(shell $(LIBPNG-CONFIG) --cflags)
|
CFLAGS += $(shell $(LIBPNG-CONFIG) --cppflags --I_opts)
|
||||||
|
|
||||||
# seems like older libpng versions are broken and need this
|
# seems like older libpng versions are broken and need this
|
||||||
PNGCONFIG_FLAGS = --ldflags --libs
|
PNGCONFIG_FLAGS = --ldflags --libs
|
||||||
@ -747,31 +747,6 @@ else
|
|||||||
quiet = quiet_
|
quiet = quiet_
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Show the command (quiet or non-quiet version based on the assignment
|
|
||||||
# just above) and then execute it.
|
|
||||||
cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
|
|
||||||
|
|
||||||
|
|
||||||
# The build commands themselves. Note that if you omit the quiet version,
|
|
||||||
# nothing will be shown in the non-verbose mode.
|
|
||||||
|
|
||||||
quiet_cmd_compile_link = '===> Compiling and Linking $@'
|
|
||||||
cmd_compile_link = $(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
|
|
||||||
|
|
||||||
quiet_cmd_ttd_link = '===> Linking $@'
|
|
||||||
cmd_ttd_link = $(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
|
|
||||||
|
|
||||||
COMPILE_PARAMS=$(CFLAGS) $(CDEFS) -MD -c $< -o $@
|
|
||||||
|
|
||||||
quiet_cmd_c_compile = '===> Compiling $<'
|
|
||||||
cmd_c_compile = $(CC) $(COMPILE_PARAMS)
|
|
||||||
|
|
||||||
quiet_cmd_cxx_compile = '===> Compiling $<'
|
|
||||||
cmd_cxx_compile = $(CXX) $(COMPILE_PARAMS)
|
|
||||||
|
|
||||||
quiet_cmd_objc_compile = '===> Compiling $<'
|
|
||||||
cmd_objc_compile = $(CC) $(COMPILE_PARAMS)
|
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@ -799,11 +774,13 @@ endian_target.h: $(ENDIAN_CHECK)
|
|||||||
$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
|
$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
|
||||||
|
|
||||||
$(ENDIAN_CHECK): endian_check.c
|
$(ENDIAN_CHECK): endian_check.c
|
||||||
$(call cmd,compile_link)
|
@echo '===> Compiling and Linking $@'
|
||||||
|
$(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
|
||||||
|
|
||||||
|
|
||||||
$(TTD): table/strings.h $(OBJS) $(MAKE_CONFIG)
|
$(TTD): $(OBJS) $(MAKE_CONFIG)
|
||||||
$(call cmd,ttd_link)
|
@echo '===> Linking $@'
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $(TTDLDFLAGS) $(OBJS) $(LIBS) -o $@
|
||||||
|
|
||||||
$(OSX): $(TTD)
|
$(OSX): $(TTD)
|
||||||
$(Q)rm -fr "$(OSXAPP)"
|
$(Q)rm -fr "$(OSXAPP)"
|
||||||
@ -829,7 +806,8 @@ $(64_bit_warnings):
|
|||||||
$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
|
$(warning If you see any bugs, include in your bug report that you use a 64 bit CPU)
|
||||||
|
|
||||||
$(STRGEN): strgen/strgen.c endian_host.h
|
$(STRGEN): strgen/strgen.c endian_host.h
|
||||||
$(call cmd,compile_link)
|
@echo '===> Compiling and Linking $@'
|
||||||
|
$(Q)$(CC_HOST) $(CFLAGS_HOST) $(CDEFS) $< -o $@
|
||||||
|
|
||||||
table/strings.h: lang/english.txt $(STRGEN)
|
table/strings.h: lang/english.txt $(STRGEN)
|
||||||
@echo '===> Generating $@'
|
@echo '===> Generating $@'
|
||||||
@ -1015,28 +993,36 @@ upgradeconf: $(MAKE_CONFIG)
|
|||||||
DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx)
|
DEPS_MAGIC := $(shell mkdir -p .deps .deps/music .deps/sound .deps/video .deps/os .deps/os/macosx)
|
||||||
|
|
||||||
# Introduce the dependencies
|
# Introduce the dependencies
|
||||||
|
ifneq ($(MAKECMDGOALS), clean)
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
endif
|
||||||
|
|
||||||
# This compiles the object file as well as silently updating its dependencies
|
%.o: .deps/%.d
|
||||||
# list at the same time. It is not an issue that they aren't around during the
|
|
||||||
# first compilation round as we just build everything at that time anyway,
|
|
||||||
# therefore we do not need to watch deps.
|
|
||||||
|
|
||||||
%.o: %.c $(MAKE_CONFIG) endian_target.h table/strings.h
|
.deps/%.d: %.c table/strings.h endian_target.h
|
||||||
$(call cmd,c_compile)
|
@echo '===> Determining dependencies of $<'
|
||||||
@[ -f $(<:%.c=%.d) ] && mv $(<:%.c=%.d) $(<:%.c=.deps/%.d) || mv $(*F).d $(<:%.c=.deps/%.d)
|
$(Q)$(CC) $(CFLAGS) -M $< > $@
|
||||||
|
|
||||||
%.o: %.cpp $(MAKE_CONFIG) endian_target.h table/strings.h
|
.deps/%.d: %.cpp table/strings.h endian_target.h
|
||||||
$(call cmd,cxx_compile)
|
@echo '===> Determining dependencies of $<'
|
||||||
@[ -f $(<:%.cpp=%.d) ] && mv $(<:%.cpp=%.d) $(<:%.cpp=.deps/%.d) || mv $(*F).d $(<:%.cpp=.deps/%.d)
|
$(Q)$(CXX) $(CFLAGS) -M $< > $@
|
||||||
|
|
||||||
%.o: %.m $(MAKE_CONFIG) endian_target.h table/strings.h
|
.deps/%.d: %.m table/strings.h endian_target.h
|
||||||
$(call cmd,objc_compile)
|
@echo '===> Determining dependencies of $<'
|
||||||
@[ -f $(<:%.m=%.d) ] && mv $(<:%.m=%.d) $(<:%.m=.deps/%.d) || mv $(*F).d $(<:%.m=.deps/%.d)
|
$(Q)$(OBJC) $(CFLAGS) -M $< > $@
|
||||||
|
|
||||||
# Silence stale header dependencies
|
|
||||||
%.h:
|
%.o: %.c $(MAKE_CONFIG)
|
||||||
@true
|
@echo '===> Compiling $<'
|
||||||
|
$(Q)$(CC) $(CFLAGS) $(CDEFS) -c -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.cpp $(MAKE_CONFIG)
|
||||||
|
@echo '===> Compiling $<'
|
||||||
|
$(Q)$(CXX) $(CFLAGS) $(CDEFS) -c -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.m $(MAKE_CONFIG)
|
||||||
|
@echo '===> Compiling $<'
|
||||||
|
$(Q)$(OBJC) $(CFLAGS) $(CDEFS) -c -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
info:
|
info:
|
||||||
|
Loading…
Reference in New Issue
Block a user