mbox series

[00/16] Makefiles: dependency correctness & speedup

Message ID cover-00.16-00000000000-20211106T205717Z-avarab@gmail.com (mailing list archive)
Headers show
Series Makefiles: dependency correctness & speedup | expand

Message

Ævar Arnfjörð Bjarmason Nov. 6, 2021, 9:03 p.m. UTC
This is a series to correct various issues in the Makefile. This goes
on top of my ab/sh-retire-helper-functions sitting in "next".

Let's drop the other outstanding Makefile[1] series I have for now
(not picked up anyway). Unlike that one this is purely Makefile fixes,
and no breakage or change in CMake behavior etc.

Inline comments below:

Ævar Arnfjörð Bjarmason (16):
  Makefile: don't set up "perl/build" rules under NO_PERL=Y
  Makefile: clean perl/build/ even with NO_PERL=Y
  Makefile: remove "mv $@ $@+" dance redundant to .DELETE_ON_ERROR
  Makefile: move Perl-only variable assignments under !NO_PERL
  Makefile: correct "GIT-PERL-{DEFINES,HEADER}" dependency graph
  Makefile: don't have Perl over-depend on GIT-BUILD-OPTIONS
  Makefile: create a GIT-PYTHON-DEFINES, like "PERL"

Various fixes for Perl dependency issues, and eventual alignment of
how we generrate the "DEFINES" file for Perl and Python. These are
straightforward follow-ups to the Makefile parts of
ab/sh-retire-helper-functions, just for *.perl and *.py instead of
*.sh.

  Makefile: stop needing @@GIT_VERSION@@ in *.perl scripts

By not substituting @@GIT_VERSION@@ in the *.perl scripts we don't
need to re-build them every time HEAD changes.

  Makefiles: add "shared.mak", move ".DELETE_ON_ERROR" to it

Create a shared.mak, to be used by all in-tree Makefiles, to define
common utilities etc.

  Makefile: move $(comma), $(empty) and $(space) to shared.mak
  Makefile: re-add and use the "shellquote" macros

Our quoting is really ugly in Makefiles. This resurrects a 2005-era
commit from Junio to make it better, then it relied on GNU make
features that were too new, but we already hard depend on versions
older than that now, so...

  Makefile: add a "TRACK_template" for GIT-*{FLAGS,DEFINES,...}

Since we can use $(call) let's use it to get rid of this particularly
egregious case of copy/pasting...

  Makefile: add "$(QUIET)" boilerplate to shared.mak
  Makefile: use $(wspfx) for $(QUIET...) in shared.mak

...and the $(QUIET) copy/pasting...

  Makefiles: add and use wildcard "mkdir -p" template

Optimizes a recent "mkdir -p" pattern I added for speed and
readability.

  Makefile: don't invoke msgfmt with --statistics

Miscellaneous small output fix tacked at the end.

1. https://lore.kernel.org/git/xmqqtugr3l4r.fsf@gitster.g/T/#m1ab315e3dbb323427d373d1fcee4534b67d6a6dd

 .gitignore             |   2 +-
 Documentation/Makefile |  71 ++----------
 Makefile               | 238 +++++++++++++----------------------------
 config.mak.uname       |   1 -
 git-cvsserver.perl     |   6 +-
 git-send-email.perl    |   7 +-
 git-svn.perl           |   2 +-
 shared.mak             | 113 +++++++++++++++++++
 t/Makefile             |  34 +++---
 templates/Makefile     |  19 +---
 10 files changed, 222 insertions(+), 271 deletions(-)
 create mode 100644 shared.mak