X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=stepmake%2Fstepmake%2Fmetafont-vars.make;fp=stepmake%2Fstepmake%2Fmetafont-vars.make;h=73f35a53ed68cd0490ccaa367b5f58fe83739492;hb=92b74608ea370b869bacb82d293decddfe4f8565;hp=aeb75c5f004cf1ab1da0e78b985dfdd93dab11be;hpb=cbe41403f58c9e30a1ba86d5f802b007d61748d6;p=lilypond.git diff --git a/stepmake/stepmake/metafont-vars.make b/stepmake/stepmake/metafont-vars.make index aeb75c5f00..73f35a53ed 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 ) &&