From a6cfe9c0520af47d1bdd153bb13406ec5c2fe9c2 Mon Sep 17 00:00:00 2001 From: jnasbyupgrade Date: Thu, 6 Aug 2026 15:52:49 -0500 Subject: [PATCH] lint.mk: guard the submodule include on .git existing An unconditional `include .vendor/linter/lint.mk` (via the self-init rule `git submodule update --init`) breaks EVERY make invocation -- not just `make lint` -- when building from a source tarball. Make tries to satisfy every `include` before doing anything else, for any target requested; a real PGXN distribution tarball (git archive, make dist's own output) has no .git and no submodule content, so `git submodule update` fails outright ("fatal: not a git repository"), and that failure aborted the whole build. Confirmed by building a real `git archive` tarball into a clean directory with no .git at all: a plain `make` failed immediately with "fatal: not a git repository" before doing anything else, real exit code 2. Fix: guard the self-init rule and include behind `ifneq ($(wildcard .git),)`. Confirmed both directions: a real git checkout still runs `make lint` successfully (submodule auto-inits as before) and a plain `make` still succeeds there too; the same tarball now builds successfully with a plain `make`, and `make lint` there fails with Make's own "no rule to make target" instead of aborting every target. Co-Authored-By: Claude Sonnet 5 --- lint.mk | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lint.mk b/lint.mk index 0d18abf..1534363 100644 --- a/lint.mk +++ b/lint.mk @@ -5,7 +5,22 @@ # Self-initializing (via the rule below) so `make lint` works right after a # plain `git clone`, with no --recurse-submodules needed, and so CI can rely # on the exact same entry point a developer would use locally. +# +# Guarded on .git existing: a source tarball (git archive, PGXN's own dist +# step) has no .git and no submodule content, so `git submodule update` +# fails outright ("fatal: not a git repository") -- and because Make tries +# to satisfy every `include` before doing anything else, for any target +# requested, an unconditional include here aborted EVERY make invocation +# (make, make install, everything), not just make lint, the moment a real +# consumer built from a distribution tarball rather than a git checkout. +# Confirmed by building a real `git archive` tarball into a clean directory +# with no .git at all and running a plain `make` there. Outside a real git +# checkout, lint support is simply unavailable; nothing else in the build +# needs it -- `make lint` there now fails with Make's own "no rule to make +# target" instead of `make`/`make install` failing too. +ifneq ($(wildcard .git),) .vendor/linter/lint.mk: git submodule update --init -- .vendor/linter include .vendor/linter/lint.mk +endif