Changeset - r23163:4fe2df111fb0
[Not reviewed]
master
0 2 0
glx - 6 years ago 2019-01-15 01:26:54
glx@openttd.org
Fix: deps calculation call could fail due to command line length
2 files changed with 15 insertions and 9 deletions:
0 comments (0 inline, 0 general)
Makefile.src.in
Show inline comments
 
@@ -156,31 +156,37 @@ ifeq ("$(SRC_OBJS_DIR)/$(DEPEND)","$(MAK
 
DEP := $(MAKEDEPEND)
 
$(SRC_OBJS_DIR)/$(DEPEND): $(SRC_DIR)/depend/depend.cpp
 
	$(E) '$(STAGE) Compiling and linking $(DEPEND)'
 
	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $(CXXFLAGS_BUILD) $(LDFLAGS_BUILD) -o $@ $<
 
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
 
ifeq ($(filter depend, $(MAKECMDGOALS)),)
 
Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(CONFIG_CACHE_SOURCE) $(DEP)
 
else
 
Makefile.dep: $(FILE_DEP) $(SRCS:%=$(SRC_DIR)/%) $(DEP) FORCE
 
endif
 
	$(E) '$(STAGE) DEP CHECK (all files)'
 
	$(Q)rm -f Makefile.dep.tmp
 
	$(Q)touch Makefile.dep.tmp
 

	
 
# 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
 

	
 
# 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
 
	$(call xargs,$(Q)$(MAKEDEPEND) -f$(SRC_OBJS_DIR)/Makefile.dep.tmp -o.o -Y -v -a -- $(CFLAGS_MAKEDEP) -- 2>/dev/null,$(SRCS:%=$(SRC_DIR)/%))
 

	
 
# Remove all comments and includes that don't start with $(SRC_DIR)
 
# Remove $(SRC_DIR) from object-file-name
 
	@$(AWK) '                           \
 
	/^# DO NOT/ { print $$0 ; next}     \
 
	/^#/ {next}                         \
config.lib
Show inline comments
 
@@ -1956,13 +1956,13 @@ make_cflags_and_ldflags() {
 
	# Also make makedepend aware of compiler's built-in defines.
 
	if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
 
		# Append CXXFLAGS possibly containing -std=c++0x
 
		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
 
		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
 
		makedepend=""
 
	fi
 

	
 
	if [ "$with_distcc" != "0" ]; then
 
		cc_host="$distcc $cc_host"
0 comments (0 inline, 0 general)