From: Alejandro Colomar Date: Fri, 14 Apr 2023 15:12:30 +0000 (+0200) Subject: src.mk: Optimize pipeline X-Git-Tag: man-pages-6.05~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f76ae175aa2ad029f22dfa5c799eebc297a4e876;p=thirdparty%2Fman-pages.git src.mk: Optimize pipeline This pipeline is run for every make(1) invokation, and it was very slow, due to running a new sed(1) process for every manual page. Remove the while loop, and rewrite so that all the commands in the pipeline are only run once. This brings times down ~10x in my system, from 1.5 s, to just 0.14 s. Signed-off-by: Alejandro Colomar --- diff --git a/share/mk/build/src.mk b/share/mk/build/src.mk index 747cbd3985..365d6c8e6f 100644 --- a/share/mk/build/src.mk +++ b/share/mk/build/src.mk @@ -60,11 +60,9 @@ _SRCPAGEDIRS := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.d,$(NONSO_MAN)) _UNITS_src_src := $(patsubst $(MANDIR)/%,$(_MANDIR)/%,$(shell \ $(FIND) $(MANDIR)/man*/ -type f \ | $(GREP) '$(MANEXT)' \ - | $(XARGS) $(GREP) -l '^\.TH ' \ - | while read m; do \ - <$$m \ - $(SED) -n "s,^\... SRC BEGIN (\(.*.[ch]\))$$,$$m.d/\1,p"; \ - done \ + | $(XARGS) $(GREP) -H '^\.\\" SRC BEGIN ' \ + | $(SED) 's,:\.\\" SRC BEGIN (,.d/,' \ + | $(SED) 's/)//' \ | $(SORT))) _UNITS_src_h := $(filter %.h,$(_UNITS_src_src)) _UNITS_src_c := $(filter %.c,$(_UNITS_src_src))