Do not execute too many shell commands at once in "cleanup-style"

Otherwise, the argument to "bash -c ..." is very large, resulting in
the following error message on systems with small ARG_MAX:

make: execvp: bash: Argument list too long
This commit is contained in:
Volker Grabsch 2015-01-11 18:14:14 -05:00
parent 40fd96e236
commit dacd2ba109
1 changed files with 16 additions and 14 deletions

View File

@ -301,18 +301,20 @@ update-checksum-%:
$(error package $* not found in index.html))
.PHONY: cleanup-style
define CLEANUP_STYLE
@$(SED) ' \
s/\r//g; \
s/[ \t]\+$$//; \
s,^#!/bin/bash$$,#!/usr/bin/env bash,; \
$(if $(filter %Makefile,$(1)),,\
s/\t/ /g; \
) \
' < $(1) > $(TOP_DIR)/tmp-cleanup-style; \
diff -u $(1) $(TOP_DIR)/tmp-cleanup-style >/dev/null \
|| { echo '[cleanup] $(1)'; \
cp $(TOP_DIR)/tmp-cleanup-style $(1); }; \
rm -f $(TOP_DIR)/tmp-cleanup-style
endef
cleanup-style:
@$(foreach FILE,$(wildcard $(addprefix $(TOP_DIR)/,Makefile index.html CNAME src/*.mk src/*test.* tools/*)),\
$(SED) ' \
s/\r//g; \
s/[ \t]\+$$//; \
s,^#!/bin/bash$$,#!/usr/bin/env bash,; \
$(if $(filter %Makefile,$(FILE)),,\
s/\t/ /g; \
) \
' < $(FILE) > $(TOP_DIR)/tmp-cleanup-style; \
diff -u $(FILE) $(TOP_DIR)/tmp-cleanup-style >/dev/null \
|| { echo '[cleanup] $(FILE)'; \
cp $(TOP_DIR)/tmp-cleanup-style $(FILE); }; \
rm -f $(TOP_DIR)/tmp-cleanup-style; \
)
$(foreach FILE,$(wildcard $(addprefix $(TOP_DIR)/,Makefile index.html CNAME src/*.mk src/*test.* tools/*)),$(call CLEANUP_STYLE,$(FILE)))