Summary
The tangled outputs of this repo (the .mk fragments and latexmkrc) cannot be
rebuilt from their .nw sources via the included rules themselves. Only the
repo's own top-level Makefile knows how to tangle them. As a result:
- A downstream project that
includes e.g. tex.mk has no automatic way to
regenerate a stale or missing tex.mk/latexmkrc from tex.mk.nw.
- Even inside this repo,
make latexmkrc is broken by a target-name collision
(see below), so it never actually tangles latexmkrc.
Request: add rules so all .mk files (and latexmkrc) are rebuilt from their
.nw sources automatically as part of the rules, so both this repo and its
downstream consumers self-heal instead of relying on a committed copy.
Motivation (how this surfaced)
In a downstream project that uses this repo as a submodule, latexmkrc was a
gitignored generated artifact (commit 53e54b0). After a git submodule update
the file was gone, the downstream latexmkrc symlink dangled, latexmk ran
without the PythonTeX cus_dep, and the PDFs showed ?? PythonTeX ??.
Worked around downstream by committing the tangled latexmkrc so it ships with
the submodule (makefiles@f88f075) and by depending on the latexmkrc target so
the symlink is recreated. But the root cause is that the build can't regenerate
its own tangled outputs.
Bug: latexmkrc target-name collision
Makefile defines the tangle recipe:
latexmkrc: tex.mk.nw
${NOTANGLE}
but the included tex.mk also defines a latexmkrc: target (the symlink
helper):
latexmkrc:
[ -e $@ -o "${INCLUDE_MAKEFILES}" = "." ] || \
${LN} -s ${INCLUDE_MAKEFILES}/latexmkrc $@
Since tex.mk is included after the explicit rule, its recipe wins. Running
make latexmkrc (or make all, via OTHERS+= latexmkrc) emits:
tex.mk:91: warning: overriding recipe for target 'latexmkrc'
Makefile:35: warning: ignoring old recipe for target 'latexmkrc'
and runs only the symlink helper — which is a no-op here (INCLUDE_MAKEFILES=.
makes the guard short-circuit). The tangled latexmkrc is therefore never
produced by make; it only exists because it is now committed.
Suggested direction (non-prescriptive)
-
Resolve the latexmkrc name collision so the tangle rule applies when
building inside this repo and the symlink helper applies downstream (rename
one target, or guard the recipes on INCLUDE_MAKEFILES).
-
Provide a generic tangle pattern rule for fragments, e.g. %.mk: %.mk.nw
(and an equivalent for latexmkrc) in noweb.mk/tex.mk, so any included
.mk self-rebuilds from its .nw whenever the .nw source is present. The
generic NOTANGLE recipe already exists in noweb.mk:
NOTANGLE?= notangle ${NOTANGLEFLAGS} -R"[[$(notdir $@)]]" $(filter %.nw,$^) | \
${CPIF} $@ && noroots $(filter %.nw,$^)
Repro
git clone git@github.com:dbosk/makefiles.git && cd makefiles
make latexmkrc # prints the "overriding recipe" warnings; no tangled latexmkrc
Summary
The tangled outputs of this repo (the
.mkfragments andlatexmkrc) cannot berebuilt from their
.nwsources via the included rules themselves. Only therepo's own top-level
Makefileknows how to tangle them. As a result:includes e.g.tex.mkhas no automatic way toregenerate a stale or missing
tex.mk/latexmkrcfromtex.mk.nw.make latexmkrcis broken by a target-name collision(see below), so it never actually tangles
latexmkrc.Request: add rules so all
.mkfiles (andlatexmkrc) are rebuilt from their.nwsources automatically as part of the rules, so both this repo and itsdownstream consumers self-heal instead of relying on a committed copy.
Motivation (how this surfaced)
In a downstream project that uses this repo as a submodule,
latexmkrcwas agitignored generated artifact (commit
53e54b0). After agit submodule updatethe file was gone, the downstream
latexmkrcsymlink dangled,latexmkranwithout the PythonTeX
cus_dep, and the PDFs showed?? PythonTeX ??.Worked around downstream by committing the tangled
latexmkrcso it ships withthe submodule (
makefiles@f88f075) and by depending on thelatexmkrctarget sothe symlink is recreated. But the root cause is that the build can't regenerate
its own tangled outputs.
Bug:
latexmkrctarget-name collisionMakefiledefines the tangle recipe:but the included
tex.mkalso defines alatexmkrc:target (the symlinkhelper):
Since
tex.mkis included after the explicit rule, its recipe wins. Runningmake latexmkrc(ormake all, viaOTHERS+= latexmkrc) emits:and runs only the symlink helper — which is a no-op here (
INCLUDE_MAKEFILES=.makes the guard short-circuit). The tangled
latexmkrcis therefore neverproduced by
make; it only exists because it is now committed.Suggested direction (non-prescriptive)
Resolve the
latexmkrcname collision so the tangle rule applies whenbuilding inside this repo and the symlink helper applies downstream (rename
one target, or guard the recipes on
INCLUDE_MAKEFILES).Provide a generic tangle pattern rule for fragments, e.g.
%.mk: %.mk.nw(and an equivalent for
latexmkrc) innoweb.mk/tex.mk, so any included.mkself-rebuilds from its.nwwhenever the.nwsource is present. Thegeneric
NOTANGLErecipe already exists innoweb.mk:Repro