On Fri, Dec 24 2021, Ævar Arnfjörð Bjarmason wrote: A gentle reminder about considering picking up this topic that got lost around the holidays. This one is independent of the other Makefile topic I've got outstanding at https://lore.kernel.org/git/220221.86r17w9dsq.gmgdl@xxxxxxxxxxxxxxxxxxx/ This thread doesn't have any reviews, but I see that's because I screwed up and omitted the In-Reply-To at the time. There was feeback on the v1 of this: https://lore.kernel.org/git/cover-0.8-00000000000-20211217T012902Z-avarab@xxxxxxxxx/ That v1 was in turn split off from a larger series, and as the range-diff for that v1 shows the split-off version was was mostly unchanged from that version, which had a few eyeballs on it. > As the v1 notes (among other things): > https://lore.kernel.org/git/cover-0.8-00000000000-20211217T012902Z-avarab@xxxxxxxxx/ > > This speeds up noop runs of "make" by a lot. After a "make" running a > "make -j1" with this is ~1.5 faster than on "master"[2], and around 3x > as fast with "make -j1 NO_TCLTK=Y" (the TCL part takes a lot of time, > but that's another matter). > > This v2 re-roll addresses trivial commit message/comment grammar/typo > issues pointed out by Eric Sunshine, thanks Eric! > > Ævar Arnfjörð Bjarmason (8): > Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it > Makefile: disable GNU make built-in wildcard rules > Makefile: define $(LIB_H) in terms of $(FIND_SOURCE_FILES) > Makefile: move ".SUFFIXES" rule to shared.mak > Makefile: move $(comma), $(empty) and $(space) to shared.mak > Makefile: add "$(QUIET)" boilerplate to shared.mak > Makefile: use $(wspfx) for $(QUIET...) in shared.mak > Makefiles: add and use wildcard "mkdir -p" template > > Documentation/Makefile | 63 +++------------------- > Makefile | 118 +++++++++++++---------------------------- > config.mak.uname | 1 - > shared.mak | 109 +++++++++++++++++++++++++++++++++++++ > t/Makefile | 3 ++ > t/interop/Makefile | 3 ++ > templates/Makefile | 8 ++- > 7 files changed, 160 insertions(+), 145 deletions(-) > create mode 100644 shared.mak > > Range-diff against v1: > 1: f74b47662b7 = 1: b652fc78fda Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it > 2: b0c63abe091 = 2: b0c9be581a6 Makefile: disable GNU make built-in wildcard rules > 3: c6c6f7cf8d8 = 3: ed6fd1c0bd1 Makefile: define $(LIB_H) in terms of $(FIND_SOURCE_FILES) > 4: ed64cd1bd4a = 4: 4c6d8089fff Makefile: move ".SUFFIXES" rule to shared.mak > 5: 1749085b929 = 5: f1f02c71dbc Makefile: move $(comma), $(empty) and $(space) to shared.mak > 6: c25284b24cf = 6: fb877060d6b Makefile: add "$(QUIET)" boilerplate to shared.mak > 7: 3daef7672be = 7: 90d804ea9a0 Makefile: use $(wspfx) for $(QUIET...) in shared.mak > 8: aca560ca410 ! 8: 59c1b7032db Makefiles: add and use wildcard "mkdir -p" template > @@ Commit message > > But as it turns out we can use this neat trick of only doing a "mkdir > -p" if the $(wildcard) macro tells us the path doesn't exist. A re-run > - of a performance test similar to thatnoted downthread of [1] in [2] > + of a performance test similar to that noted downthread of [1] in [2] > shows that this is faster, in addition to being less verbose and more > reliable (this uses my "git-hyperfine" thin wrapper for "hyperfine"[3]): > > @@ shared.mak: ifndef V > +## needed. > +## > +## Is racy, but in a good way; we might redundantly (and safely) > -+## "mkdir -p" when running in parallel, but won't need to exhaustively > ++## "mkdir -p" when running in parallel, but won't need to exhaustively create > +## individual rules for "a" -> "prefix" -> "dir" -> "file" if given a > +## "a/prefix/dir/file". This can instead be inserted at the start of > +## the "a/prefix/dir/file" rule.