[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Identify included files
From: |
Fr. Samuel Springuel |
Subject: |
Re: Identify included files |
Date: |
Fri, 22 May 2020 14:56:08 -0400 |
> On 21 May, 2020, at 9:08 PM, David Wright <address@hidden> wrote:
>
> Look¹, I'm not the one making this analogy. I'm trying to make any
> sense of it, and why this "dependency file" is being built.
Well, perhaps it’s time to drop the analogy then and work with an example. For
reference sake, let’s use the makefile example in the documentation:
http://lilypond.org/doc/v2.21/Documentation/usage/make-and-makefiles
In that file you’ve got the following section which lists file dependencies:
# The dependencies of the movements.
$(piece)I.pdf: $(piece)I.ly $(notes)
$(piece)II.pdf: $(piece)II.ly $(notes)
$(piece)III.pdf: $(piece)III.ly $(notes)
$(piece)IV.pdf: $(piece)IV.ly $(notes)
# The dependencies of the full score.
$(piece).pdf: $(piece).ly $(notes)
# The dependencies of the parts.
$(piece)-cello.pdf: $(piece)-cello.ly cello.ily
$(piece)-horn.pdf: $(piece)-horn.ly horn.ily
$(piece)-oboes.pdf: $(piece)-oboes.ly oboe.ily
$(piece)-viola.pdf: $(piece)-viola.ly viola.ily
$(piece)-violinOne.pdf: $(piece)-violinOne.ly violinOne.ily
$(piece)-violinTwo.pdf: $(piece)-violinTwo.ly violinTwo.ily
As I see it, there are two problems with this section:
1) None of these dependencies mention symphonyDefs.ily. If I make any changes
to it (say I change the paper size from A4 to Letter), then make will **not**
know the pdfs are now out of date.
2) These lists are manually maintained. Each time I add another part I’ve got
to add another line. If I add more dependencies (perhaps by pulling from a
library of commonly used tweaks that I reuse from project to project), I have
to make sure those are listed. If I decide to change the output format from
pdf to eps, I’ve got to change everyone of these rules (as well as a couple of
other things). Basically, any little change to the project structure requires
me to edit the Makefile, sometimes in several places, and that introduces
opportunities for error.
The point of the dependency files that I’m trying to build is to fix these
problems and do so automatically (so that once it is fixed, its fixed for all
time). Under this idea (with parse-only.ly in the file structure alongside
Makefile, latest version is attached) the above section of the makefile becomes:
LY_all := $(wildcard Parts/*.ly) $(wildcard Scores/*.ly)
include $(LY_all:.ly=.dly)
%.dly: %.ly parse-only.ly
@set -e; rm -f $@; \
$(LILY_CMD) --silent --init parse-only.ly $< > $@.$$$$; \
sed '1s,^,$@ ,' < $@.$$$$ > $@; \
rm -f $@.$$$$
You’ll note, this is fewer total lines and it doesn’t care how many parts or
scores there are. Add a part or a score and make will notice and create the
dependency list for that part/score automatically. Find a snippet that does
something that you want to happen in one or more scores, simply add the
necessary \include statements to the appropriate file(s) and make will notice
and update accordingly. Want to switch from pdf to eps (by adding the -E flag
to LILY_CMD)? Well, there are other parts of the Makefile which will need
edits (because the Makefile was not written with this switch in mind), but as
far as the dependencies are concerned no changes are necessary, you just need
to clean out the existing dly files (which are written for the pdf targets) and
make will create the new ones for the eps targets.
✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036
PAX ☧ ΧΡΙΣΤΟΣ
parse-only.ly
Description: Binary data
- Re: Identify included files, (continued)
- Re: Identify included files, David Wright, 2020/05/21
- Re: Identify included files, antlists, 2020/05/21
- Re: Identify included files, David Wright, 2020/05/21
- Re: Identify included files, Wols Lists, 2020/05/22
- Re: Identify included files, Michael Gerdau, 2020/05/23
- Re: Identify included files, antlists, 2020/05/23
- Re: Identify included files, David Wright, 2020/05/23
- Re: Identify included files,
Fr. Samuel Springuel <=
- Re: Identify included files, antlists, 2020/05/18
- Re: Identify included files, David Wright, 2020/05/18
- Re: Identify included files, Urs Liska, 2020/05/18
Re: Identify included files, David Kastrup, 2020/05/15