DOC: Changes to the documentation on using Make with LilyPond
A revision of !180 (closed)
In the first part where the top of the ly files is described, the example code (for symphony-cello.ly) add quotation marks around the names of the files in the
\includestatements. As best I can understand, these quotation marks are required by the syntax of the
The model Makefile for *nix OSes has several things about it which I think make it less than ideal as an example. In particular:
a) the definition of CPU_CORES is not portable to macOS as /proc/cpuinfo is not present in macOS. Further, make never passes more than one target to LilyPond at a time (the recipe passes just the first prerequisite) and so there is no benefit to using the -djob-count flag. I therefore remove this variable and flag.
b) The portions of the recipe for moving the pdf and midi files is overly complicated by the tests to see if the files exist. Further, these tests are only needed because it has been written as a 1-logical-line script which means that the shell has control over the continuation of the recipe rather than make. I rewrite the recipe as 3 logical lines so that make will automatically halt the recipe if the creation of the pdf and midi files by LilyPond fails.
c) The archive target is eliminated because it refers to a directory outside of the example hierarchy (this also brings things into line with the Windows example makefile, where the target is already eliminated).
d) The Makefile doesn’t check to see if the PDF and MIDI directories exist when executing the recipe to create pdf and midi files. To correct this, I added them as order-only prerequisites and recipes to create these directories should they be missing.
e) The comment describing the target names for the parts is contradictory. It first says that
make foo.pdfis the appropriate target for instrument foo (which would be
make cello.pdffor the cello), and then gives the example of
make symphony-cello.pdf. It is corrected to be consistent and correct.
f) No .DEFAULT_GOAL is specified, so make falls back on picking the first target. I add the .DEFAULT_GOAL explicitly as score so that those less familiar with make aren’t surprised by a new default goal as they modify the file to their own use case.
g) symphonyDefs.ily is added as a prerequisite to all of the targets (in the common variable). This way changes to symphonyDefs.ily will trigger rebuilds of the scores.
h) Variables are defined using immediate evaluation (:=) as delayed evaluation (=) is not necessary for any of them.
Changes b, d, f, g, and h are also applied to the Windows sample makefile (the others do not apply) but these have not been tested (as I don't have a Windows system with GNUmake).