mirror of
https://github.com/moparisthebest/xeps
synced 2024-12-03 06:22:16 -05:00
Fix Makefile dependencies on directories
Most jobs depend on build or one of its subdirectories. By default, this causes make to take the timestamp of the `build` directory (or the respective subdirectory) into account when calculating whether a job needs rebuilding. This is a problem, because the modified timestamp of `build` updates whenever a file is put into it. Effectively, this breaks incremental builds. Luckily, GNU(?) Make supports Order-only Dependencies, prefixed with a pipe (`|`) symbol in the dependency list. That means that the dependencies are not taken into account for freshness checks, but will be built before the target (if they are non-fresh). This commit introduces usage of Order-only Dependencies for the output directories, which fixes incremental building.
This commit is contained in:
parent
34ab0af5a0
commit
a694dd21ab
20
Makefile
20
Makefile
@ -3,7 +3,7 @@
|
||||
OUTDIR?=build
|
||||
REFSDIR?=$(OUTDIR)/refs
|
||||
EXAMPLESDIR?=$(OUTDIR)/examples
|
||||
XMLDEPS=xep.xsd xep.ent xep.dtd ref.xsl $(OUTDIR)
|
||||
XMLDEPS=xep.xsd xep.ent xep.dtd ref.xsl
|
||||
TEXMLDEPS=xep2texml.xsl $(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf
|
||||
XEPDIRS=. inbox
|
||||
HTMLDEPS=xep.xsl $(CSSTARGETS) $(JSTARGETS)
|
||||
@ -100,13 +100,13 @@ $(OUTDIR)/xep.xsl: xep.xsl $(OUTDIR)
|
||||
$(OUTDIR)/xeplist.xml: $(wildcard *.xml) $(wildcard inbox/*.xml)
|
||||
./tools/extract-metadata.py > $@
|
||||
|
||||
$(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl $(EXAMPLESDIR)
|
||||
$(EXAMPLESDIR)/%.xml: xep-%.xml $(XMLDEPS) examples.xsl | $(EXAMPLESDIR)
|
||||
xsltproc --path $(CURDIR) examples.xsl "$<" > "$@" && echo "Finished building $@"
|
||||
|
||||
$(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl $(REFSDIR)
|
||||
$(REFSDIR)/reference.XSF.XEP-%.xml: xep-%.xml $(XMLDEPS) ref.xsl | $(REFSDIR)
|
||||
xsltproc --path $(CURDIR) ref.xsl "$<" > "$@" && echo "Finished building $@"
|
||||
|
||||
$(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS)
|
||||
$(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS) | $(OUTDIR)
|
||||
xmllint --nonet --noout --noent --loaddtd --valid "$<"
|
||||
# Check for non-data URIs
|
||||
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
|
||||
@ -114,7 +114,7 @@ $(xep_htmls): $(OUTDIR)/xep-%.html: xep-%.xml $(XMLDEPS) $(HTMLDEPS)
|
||||
# Actually build the HTML
|
||||
xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
|
||||
|
||||
$(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLDEPS)
|
||||
$(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLDEPS) | $(OUTDIR)
|
||||
xmllint --nonet --noout --noent --loaddtd --valid "$<"
|
||||
# Check for non-data URIs
|
||||
! xmllint --nonet --noout --noent --loaddtd --xpath "//img/@src[not(starts-with(., 'data:'))]" $< 2>/dev/null && true
|
||||
@ -122,7 +122,7 @@ $(proto_xep_htmls): $(OUTDIR)/inbox/%.html: inbox/%.xml $(XMLDEPS) $(proto_HTMLD
|
||||
# Actually build the HTML
|
||||
xsltproc --path $(CURDIR) --param htmlbase "$(if $(findstring inbox,$<),'../','./')" xep.xsl "$<" > "$@" && echo "Finished building $@"
|
||||
|
||||
$(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: $(OUTDIR)
|
||||
$(OUTDIR)/xmpp.pdf $(OUTDIR)/xmpp-text.pdf: | $(OUTDIR)
|
||||
cp "resources/$(notdir $@)" "$@"
|
||||
|
||||
$(OUTDIR)/%.pdf: %.xml $(XMLDEPS) $(TEXMLDEPS)
|
||||
@ -140,16 +140,16 @@ $(OUTDIR)/%.pdf: %.xml $(XMLDEPS) $(TEXMLDEPS)
|
||||
done
|
||||
echo "Finished building $@"
|
||||
|
||||
$(JSTARGETS): $(OUTDIR)
|
||||
$(JSTARGETS): | $(OUTDIR)
|
||||
cp "$(notdir $@)" "$@"
|
||||
|
||||
$(CSSTARGETS): $(OUTDIR)
|
||||
$(CSSTARGETS): | $(OUTDIR)
|
||||
cp "$(notdir $@)" "$@"
|
||||
|
||||
$(proto_JSTARGETS): $(OUTDIR)/inbox
|
||||
$(proto_JSTARGETS): | $(OUTDIR)/inbox
|
||||
cp "$(notdir $@)" "$@"
|
||||
|
||||
$(proto_CSSTARGETS): $(OUTDIR)/inbox
|
||||
$(proto_CSSTARGETS): | $(OUTDIR)/inbox
|
||||
cp "$(notdir $@)" "$@"
|
||||
|
||||
$(EXAMPLESDIR) $(REFSDIR) $(OUTDIR) $(OUTDIR)/inbox:
|
||||
|
Loading…
Reference in New Issue
Block a user