From b62ee2e2fbaccbbba7501115819e7d10eefe38d5 Mon Sep 17 00:00:00 2001 From: Jackson Ray Hamilton Date: Mon, 19 Dec 2016 21:44:18 -0800 Subject: [PATCH 2/2] Optimize exclusion further with case. TBH, I'm not nearly as confident in this code as the code it replaces, but it is slightly faster. --- GNUmakefile | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9690af4..442dd9c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -148,17 +148,22 @@ $(foreach al, $(autoloads), $(eval $(call RULE-srcdeps, $(al)))) # the -autoloads.el, the .el files that are marked "no-byte-compile", and # files matching patterns in packages' .elpaignore files. included_els := $(shell \ - for pt in packages/*; do \ - if [ -f "$${pt}/.elpaignore" ]; then \ - ignore="$${pt}/.elpaignore"; \ - else \ - ignore="/dev/null"; \ - fi; \ - if [ -d $$pt ]; then \ - tar -ch $$pt/*.el --no-recursion \ - --exclude-vcs -X "$$ignore" \ - | tar --list; \ - fi; \ + for pt in packages/*; do \ + if [ -d $$pt ]; then \ + if [ -f "$${pt}/.elpaignore" ]; then \ + cd $$pt; \ + ls -1 *.el | while IFS= read -r filename; do \ + hasmatch=0; \ + while IFS= read -r pattern; do \ + case $$filename in ($$pattern) hasmatch=1; break ;; esac;\ + done < .elpaignore; \ + test $$hasmatch = 1 || echo "$${pt}/$${filename}"; \ + done; \ + cd ../..; \ + else \ + ls -1 $$pt/*.el; \ + fi; \ + fi; \ done) els := $(call FILTER-nonsrc, $(included_els)) naive_elcs := $(patsubst %.el, %.elc, $(els)) -- 2.1.4