On 6/7/20, Fr. Samuel Springuel <rpspring...@gmail.com> wrote:
> Attached is my proposed revision to the sample Makefile which deals with all
> of the above issues.

Greetings,
I’ve tried integrating your changes (see attached), but I have a few questions:
- are we definitely sure that -djob-count is a no-op?  Couldn’t it be
useful in some cases, for some other makefiles (since that one is
supposed to be a general template)?  For now I suggest to keep it just
in case, and added a possible variant for MacOSX/BSD systems.
- the common definitions file could be defined as variable, wouldn’t
that be better for adaptability?
- btw: are we sure it needs to be added as a target in every case,
even though it’s supposed to already be \include-d in the ly files
themselves?
- could you (even without testing) propose some updates to the Windows
makefile, or is it acceptable in your opinion to leave it unchanged
for now?

Cheers,
-- V.
diff --git a/Documentation/usage/suggestions.itely 
b/Documentation/usage/suggestions.itely
index 73de64e0f9..a1f465b7fd 100644
--- a/Documentation/usage/suggestions.itely
+++ b/Documentation/usage/suggestions.itely
@@ -366,8 +366,8 @@ files in the @file{Notes} directory:
 
 @example
 %%% top of file "symphony-cello.ly"
-\include ../symphonyDefs.ily
-\include ../Notes/cello.ily
+\include "../symphonyDefs.ily"
+\include "../Notes/cello.ily"
 @end example
 
 The makefile will have targets of @code{score} (entire piece in
@@ -384,8 +384,12 @@ subsequent lines must begin with tabs, not spaces.}
 @example
 # the name stem of the output files
 piece = symphony
-# determine how many processors are present
+# determine how many processors are present (GNU/Linux)
 CPU_CORES=`cat /proc/cpuinfo | grep -m1 "cpu cores" | sed s/".*: "//`
+#
+# variant for Mac OS / BSD:
+# CPU_CORES=`sysctl -n hw.ncpu`
+#
 # The command to run lilypond
 LILY_CMD = lilypond -ddelete-intermediate-files \
                     -dno-point-and-click -djob-count=$(CPU_CORES)
@@ -393,6 +397,8 @@ LILY_CMD = lilypond -ddelete-intermediate-files \
 # The suffixes used in this Makefile.
 .SUFFIXES: .ly .ily .pdf .midi
 
+.DEFAULT_GOAL = score
+
 # Input and output files are searched in the directories listed in
 # the VPATH variable.  All of them are subdirectories of the current
 # directory (given by the GNU make variable `CURDIR').
@@ -405,14 +411,18 @@ VPATH = \
 # The pattern rule to create PDF and MIDI files from a LY input file.
 # The .pdf output files are put into the `PDF' subdirectory, and the
 # .midi files go into the `MIDI' subdirectory.
-%.pdf %.midi: %.ly
-        $(LILY_CMD) $<; \           # this line begins with a tab
-        if test -f "$*.pdf"; then \
-            mv "$*.pdf" PDF/; \
-        fi; \
-        if test -f "$*.midi"; then \
-            mv "$*.midi" MIDI/; \
-        fi
+%.pdf %.midi &: %.ly | PDF MIDI
+       $(LILY_CMD) $<          # this line begins with a tab
+       mv "$*.pdf" PDF/
+       mv "$*.midi" MIDI/
+
+PDF :
+       mkdir PDF
+
+MIDI :
+       mkdir MIDI
+
+common = symphonyDefs.ily
 
 notes = \
   cello.ily \
@@ -423,21 +433,21 @@ notes = \
   violinTwo.ily
 
 # 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)
+$(piece)I.pdf: $(piece)I.ly $(notes) $common
+$(piece)II.pdf: $(piece)II.ly $(notes) $common
+$(piece)III.pdf: $(piece)III.ly $(notes) $common
+$(piece)IV.pdf: $(piece)IV.ly $(notes) $common
 
 # The dependencies of the full score.
-$(piece).pdf: $(piece).ly $(notes)
+$(piece).pdf: $(piece).ly $(notes) $common
 
 # 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
+$(piece)-cello.pdf: $(piece)-cello.ly cello.ily $common
+$(piece)-horn.pdf: $(piece)-horn.ly horn.ily $common
+$(piece)-oboe.pdf: $(piece)-oboe.ly oboe.ily $common
+$(piece)-viola.pdf: $(piece)-viola.ly viola.ily $common
+$(piece)-violinOne.pdf: $(piece)-violinOne.ly violinOne.ily $common
+$(piece)-violinTwo.pdf: $(piece)-violinTwo.ly violinTwo.ily $common
 
 # Type `make score' to generate the full score of all four
 # movements as one file.
@@ -445,14 +455,14 @@ $(piece)-violinTwo.pdf: $(piece)-violinTwo.ly 
violinTwo.ily
 score: $(piece).pdf
 
 # Type `make parts' to generate all parts.
-# Type `make foo.pdf' to generate the part for instrument `foo'.
+# Type `make symphony-foo.pdf' to generate the part for instrument `foo'.
 # Example: `make symphony-cello.pdf'.
 .PHONY: parts
 parts: $(piece)-cello.pdf \
        $(piece)-violinOne.pdf \
        $(piece)-violinTwo.pdf \
        $(piece)-viola.pdf \
-       $(piece)-oboes.pdf \
+       $(piece)-oboe.pdf \
        $(piece)-horn.pdf
 
 # Type `make movements' to generate files for the
_______________________________________________
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to