On 06/06/2020 16:34, Fr. Samuel Springuel wrote:
I have now updated the repository I posted earlier
(https://github.com/rpspringuel/lilypond_make) to contain two additional
branches:
GNUmake_dependencies: Implements dependency generation as described in the
GNUmake manual
mad-scientist_dependencies: Implements dependency generation as described in
the article that Matt linked. Right now I’ve used a simple sed script in the
recipe to add the midi file to the targets of the dly file generated by
LilyPond, but I haven’t given up on a more general solution.
Comments from anyone willing to look these over and play around with them are
greatly appreciated.
Hi Samuel,
Great work! I have not had a play, but I have had a quick look through
https://github.com/rpspringuel/lilypond_make/blob/mad-scientist_dependencies/Makefile
Just a few comments, mostly general things about makefiles, practices
that I usually follow.
Be clear about the difference between = and :=. You are using = when :=
would work fine.
Put everything that moves (!) into a variable. For example, I'd have
PDF_DIR := PDF/
Include the backslash when you define a directory (as above). This is a
habit I've got into and now rely on. It helps me.
Use `mkdir -p` to create dirs because it doesn't fail if the directory
exists. Having said that, this goes against another principle I often
try to follow: Write software according to Dijkstra's weakest
preconditions, by making it as fragile as possible (but no more
fragile!). That way the program will break if the implementation does
not follow the design, making it easier for bugs to become apparent.
With the `mkdir -p` example, it could be argued that because these
directory targets only come into play via order-only prerequisites, they
should never be called upon unless the directory does not exist...
I found
https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg00148.html
very interesting.
It describes how to get lilypond to print out dependencies. Have you
looked into this?
Best regards,
Matt