lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DOCS: include a sample "Makefile"?


From: Jonathan Kulp
Subject: Re: DOCS: include a sample "Makefile"?
Date: Mon, 18 May 2009 11:16:06 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Werner LEMBERG wrote:

Hmm.  I rather suggest that you really rename all input files
accordingly, not using trickery to rename the output files after
compilation.

Yep, I gave up pretty quick and just renamed everything. :)

BTW I like the #comments in the makefile very much.  Is it o.k. to
keep those for the docs?

Great.

One thing that's gotten away from me using all these different incarnations of the makefile is the MIDI output. The MIDI files are created only by the individual movement files so that the output is named correctly. It hasn't come up yet because I had commented out the midi blocks in those source files--it was before I learned about the \transposition function that makes transposed instruments' midi output sound right (duh...).

For the moment I've added a crude method of putting the midi files in the MIDI/ dir:

   mv PDF/*.midi MIDI/

If there's a way to automate this it would look nicer. Also, it only works on the "make movements" command. I tried "make stamitzIV.pdf" just now and it kept the midi file in the PDF directory. Sigh.

Makefile attached.

Jon

#######
# the name stem of the output files
piece = stamitz
CPU_CORES=`cat /proc/cpuinfo | grep -m1 "cpu cores" | sed s/".*: "//`
# The command to run lilypond
LILY_CMD = lilypond -ddelete-intermediate-files \
                    -dno-point-and-click -djob-count=$(CPU_CORES)

# The suffixes used in this Makefile.
.SUFFIXES: .ly .ily .pdf .midi

# Input and output files are searched in the directories listened in
# the VPATH variable.  All of them are subdirectories of the current
# directory (given by the GNU make variable `CURDIR').
VPATH = \
  $(CURDIR)/Scores \
  $(CURDIR)/PDF \
  $(CURDIR)/Parts \
  $(CURDIR)/Notes

# The pattern rule to create PDF and MIDI files from a LY input file.
# Output files are created in the `PDF' subdirectory.
%.pdf %.midi:  %.ly
        cd PDF; $(LILY_CMD) $<


notes = \
  cello.ily \
  figures.ily \
  horn.ily \
  oboe.ily \
  trioString.ily \
  viola.ily \
  violinOne.ily \
  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)

# The dependencies of the full score.
$(piece).pdf: $(piece).ly $(notes)

# The dependencies of the parts.
$(piece)-cello.pdf: $(piece)-cello.ly cello.ily \
                    figures.ily \
                    trioString.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

# Say `make score' to generate the full score of all four
# movements as one file.
.PHONY: score
score: $(piece).pdf

# Say `make parts' to generate all parts.
# Say `make foo.pdf' to generate the part for instrument `foo'.
# Example: `make cello.pdf'.
.PHONY: parts
parts: $(piece)-cello.pdf \
       $(piece)-violinOne.pdf \
       $(piece)-violinTwo.pdf \
       $(piece)-viola.pdf \
       $(piece)-oboes.pdf \
       $(piece)-horn.pdf

# Say `make movements' to generate files for the
# four movements separately.
.PHONY: movements
movements: $(piece)I.pdf \
           $(piece)II.pdf \
           $(piece)III.pdf \
           $(piece)IV.pdf
        mv PDF/*.midi MIDI/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]