diff --git a/Makefile.src.in b/Makefile.src.in --- a/Makefile.src.in +++ b/Makefile.src.in @@ -159,6 +159,19 @@ DEP := $(MAKEDEPEND) $(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) @@ -170,14 +183,7 @@ endif $(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 diff --git a/config.lib b/config.lib --- a/config.lib +++ b/config.lib @@ -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'`" # 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