mirror of https://github.com/OpenTTD/OpenTTD
Fix: deps calculation call could fail due to command line length
parent
5a09337c20
commit
ee84f98f1e
|
@ -159,6 +159,19 @@ $(SRC_OBJS_DIR)/$(DEPEND): $(SRC_DIR)/depend/depend.cpp
|
||||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) -o $@ $<
|
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) -o $@ $<
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Macro for invoking a command on groups of 100 words at a time
|
||||||
|
# (analogous to xargs(1)). The macro invokes itself recursively
|
||||||
|
# until the list of words is depleted.
|
||||||
|
#
|
||||||
|
# Usage: $(call xargs,COMMAND,LIST)
|
||||||
|
#
|
||||||
|
# COMMAND should be a shell command to which the words will be
|
||||||
|
# appended as arguments in groups of 100.
|
||||||
|
define xargs
|
||||||
|
$(1) $(wordlist 1,100,$(2))
|
||||||
|
$(if $(word 101,$(2)),$(call xargs,$(1),$(wordlist 101,$(words $(2)),$(2))))
|
||||||
|
endef
|
||||||
|
|
||||||
# Make sure that only 'make depend' ALWAYS triggers a recheck
|
# Make sure that only 'make depend' ALWAYS triggers a recheck
|
||||||
ifeq ($(filter depend, $(MAKECMDGOALS)),)
|
ifeq ($(filter depend, $(MAKECMDGOALS)),)
|
||||||
Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(CONFIG_CACHE_SOURCE) $(DEP)
|
Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(CONFIG_CACHE_SOURCE) $(DEP)
|
||||||
|
@ -170,14 +183,7 @@ endif
|
||||||
$(Q)touch Makefile.dep.tmp
|
$(Q)touch Makefile.dep.tmp
|
||||||
|
|
||||||
# Calculate the deps via makedepend
|
# Calculate the deps via makedepend
|
||||||
$(Q)$(MAKEDEPEND) -f$(SRC_OBJS_DIR)/Makefile.dep.tmp -o.o -Y -v -- $(CFLAGS_MAKEDEP) -- $(SRCS:%=$(SRC_DIR)/%) 2>/dev/null
|
$(call xargs,$(Q)$(MAKEDEPEND) -f$(SRC_OBJS_DIR)/Makefile.dep.tmp -o.o -Y -v -a -- $(CFLAGS_MAKEDEP) -- 2>/dev/null,$(SRCS:%=$(SRC_DIR)/%))
|
||||||
|
|
||||||
# Convert x:/... paths to /x/... for mingw
|
|
||||||
ifeq ($(OS), MINGW)
|
|
||||||
@cat Makefile.dep.tmp | sed 's@/\([a-zA-Z]\):\/@\/\1\/@g' > Makefile.dep.tmp.mingw
|
|
||||||
@cp Makefile.dep.tmp.mingw Makefile.dep.tmp
|
|
||||||
@rm -f Makefile.dep.tmp.mingw
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Remove all comments and includes that don't start with $(SRC_DIR)
|
# Remove all comments and includes that don't start with $(SRC_DIR)
|
||||||
# Remove $(SRC_DIR) from object-file-name
|
# Remove $(SRC_DIR) from object-file-name
|
||||||
|
|
|
@ -1959,7 +1959,7 @@ make_cflags_and_ldflags() {
|
||||||
cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
|
cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
|
||||||
|
|
||||||
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
|
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
|
||||||
cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
|
cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g;s@[ ]*-[^D][^ ]*@@g'`"
|
||||||
else
|
else
|
||||||
makedepend=""
|
makedepend=""
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue