lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Build dependencies for metafont files (issue 779). (issue 13681043)


From: julien . rioux
Subject: Build dependencies for metafont files (issue 779). (issue 13681043)
Date: Thu, 12 Sep 2013 16:22:08 +0000

Reviewers: John Mandereau,

Message:
Please review.

Description:
Build dependencies for metafont files (issue 779).

Write .dep files containing make dependency rules for .mf files,
allowing to simply type `make' to process the fonts after changing
an input'ed file and have the fonts updated with the minimum amount
of processing.

These .dep files are generated by recursively scanning for lines
of the form "input X;" in the .mf files, and looking up these
input'ed files within the mf source directory. The .dep files are
included into the build by stepmake/generic-targets.make.

http://code.google.com/p/lilypond/issues/detail?id=779

Please review this at https://codereview.appspot.com/13681043/

Affected files (+24, -3 lines):
  M stepmake/stepmake/metafont-rules.make
  M stepmake/stepmake/metafont-vars.make


Index: stepmake/stepmake/metafont-rules.make
diff --git a/stepmake/stepmake/metafont-rules.make b/stepmake/stepmake/metafont-rules.make index 5b6ad17d91a0a204a1470509e61ea3cdac5e19e7..5be005a1985dc7e998a0d85df79b40c48f4784fe 100644
--- a/stepmake/stepmake/metafont-rules.make
+++ b/stepmake/stepmake/metafont-rules.make
@@ -2,13 +2,13 @@

 # we want to see botched results as well.
 $(outdir)/%.dvi: %.mf
-       -MFINPUTS=$(src-dir) $(METAFONT) "\scrollmode; input $<;"
+       -$(DO_MF_DEP) MFINPUTS=$(src-dir) $(METAFONT) "\scrollmode; input $<;"
        gftodvi $(basename $<)
        mv $(basename $<).dvi $(outdir)
        rm $(basename $<).*gf

 $(outdir)/%.tfm $(outdir)/%.log: %.mf
- MFINPUTS=$(src-dir) $(METAFONT) "\mode:=$(MFMODE); nonstopmode; input $<;" $(METAFONT_QUIET) + $(DO_MF_DEP) MFINPUTS=$(src-dir) $(METAFONT) "\mode:=$(MFMODE); nonstopmode; input $<;" $(METAFONT_QUIET)
 # Let's keep this log output, it saves another mf run.
        mv $(basename $(@F)).log $(basename $(@F)).tfm $(outdir)
        rm -f $(basename $(@F)).*gf  $(basename $(@F)).*pk
@@ -19,7 +19,7 @@ $(outdir)/%.tfm $(outdir)/%.log: %.mf
 # the soft link for mf2pt1.mp is for recent mpost versions
 # which no longer dump a .mem file
 $(outdir)/%.pfb: %.mf $(outdir)/mf2pt1.mem $(outdir)/%.log
-       TMP=`mktemp -d $(outdir)/pfbtemp.$*.XXXXXXXXX` \
+       $(DO_MF_DEP) TMP=`mktemp -d $(outdir)/pfbtemp.$*.XXXXXXXXX` \
        && ( cd $$TMP \
                && ln -s ../mf2pt1.mem . \
                && ln -s ../../mf2pt1.mp . \
Index: stepmake/stepmake/metafont-vars.make
diff --git a/stepmake/stepmake/metafont-vars.make b/stepmake/stepmake/metafont-vars.make index aeb75c5f004cf1ab1da0e78b985dfdd93dab11be..73f35a53ed68cd0490ccaa367b5f58fe83739492 100644
--- a/stepmake/stepmake/metafont-vars.make
+++ b/stepmake/stepmake/metafont-vars.make
@@ -15,3 +15,24 @@ METAFONT_QUIET = >/dev/null
 else
 METAFONT_QUIET =
 endif
+
+# Find the metafont file $(1) within the source dirs and return its path.
+# If not found, return $(outdir)/$(1) assuming that it is a generated file.
+find-mf = \
+$(firstword \
+       $(wildcard $(src-dir)/$(1)) \
+       $(wildcard $(top-src-dir)/mf/$(1)) \
+       $(outdir)/$(1) \
+)
+
+# Recursively scan the metafont .mf file $(1) for "input X;"
+# and return all dependencies.
+scan-mf = \
+$(foreach f, $(shell test -f $(1) && sed -ne "/^[[:space:]]*input[[:space:]]/s/^[[:space:]]*input\([^.;]*\)\(.mf;\|;\)/\1.mf/p" $(1)), \
+       $(call find-mf,$(f)) \
+       $(call scan-mf,$(call find-mf,$(f))) \
+)
+
+# Find dependencies for the target $@, based on the metafont source file $<,
+# and write the dependencies to a .dep file.
+DO_MF_DEP = ( echo ./$@: $(call scan-mf,$<) > $(basename $@).dep ) &&





reply via email to

[Prev in Thread] Current Thread [Next in Thread]