lilypond-devel
[Top][All Lists]
Advanced

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

Re: DOCS: revising LM "Score and Parts"


From: Jonathan Kulp
Subject: Re: DOCS: revising LM "Score and Parts"
Date: Tue, 26 May 2009 21:41:30 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Henning Plumeyer wrote:
Am 26.05.2009, 04:13 Uhr, schrieb Jonathan Kulp <address@hidden>:

I had to comment out one more thing before it would run properly, though--the "-djob-count" option, something we put in on the Linux version to take advantage of dual processors. It choked on that saying "unbound variable 'primitive-fork'". This could be because I'm running on a virtual machine, though. Did it work properly for you with the multiple jobs option?

Hi Jon,
it worked properly for me. Maybe you got the long line cut like I saw
it on the gmane web interface. Below I put a version with three lines
for the lilypond command (as attachement also).

Hmm. It still doesn't work for me with the job-count option. It must be because I'm using virtual machines. I installed a virtual XP machine today for testing. It has the annoying "Documents and Settings" with spaces in the dirname. Windows 7 at least doesn't have this problem.



BTW: I got no difference with the "-djob-count" or without it.
   With the option: 2:45.218
   without        : 2:45.000(!)
(On a 2.2GHz Athlon 64 X2 Dual Core Processor--is that a normal time?)
Seems as if the option should be omitted on Windows for simplicity.

I also got a way to work around the path-with-blank(s) problem.
Instead of CURDIR I fill and use a variable "workdir" in VPATH.
(Change the name if you like, I'm not a native speaker.) The used
technique for getting the 8.3 version of CURDIR is explained near
the end of the help for the command for ("for /h" on the Windows
commandline).


I like this. It's probably essential for Windows versions earlier than Vista that have the spaces in the dirnames. Thanks for figuring this out. It works great.

Instead of %%b %%a could be used, but as a German I don't like sa...

I am looking for a way to distinguish from within the makefile
if make is running on Linux or Windows. Perhaps we could use the
environment variable "OS" which is OS=Windows_NT on my computer.

make has "ifdef variable-name" and "ifeq (arg1, arg2)", so there
should be a chance. Then perhaps it could be possible to have the
same makefile for Linux (and OSX?) and Windows.

Does Linux have a varialble OS? If not, we can check for
existence, if yes we check the value.


When I run "env" I don't get a value for OS. In my shell scripts that I want to run on either Linux or Mac OSX, I check OS with this:

OS=$(uname)

Really, though, I think it's probably best to have two different Makefiles to avoid complication. These are intended to give noobs direction in creating their own, and for me it's better to reduce the complications.

Regarding the mid/midi thing:

We could use -dmidi-extension to set the default file extension
for MIDI output file to midi, but that touches the question of
the proper extension for midi.
(http://news.gmane.org/find-root.php?message_id=%3c20090408193658.GA2963%40zonnet.nl%3e)

Could we let lilypond give us the answer itself?
On Windows:
MidiExtWithQuotes = $(shell for /f "delims=() tokens=2" %%a in \
            ('lilypond -dhelp 2^>nul^|find "midi-extension"') \
            do echo %%a)

How can this be achived on Linux? You would have to build a
command that gives
midi
and nothing else.


This is a pretty cool feature you've written but I'm inclined just to live with .mid for the sake of simplicity.

At one point I had a target to create only midi, but now I'm letting the midi files be created by the "movements" target. None of the other targets create midi files. It would be easy to have a midi-only target with the -dno-print-pages option, I guess. Do you think it would be better to separate midi into its own target?

Jon


########

# the name stem of the output files
piece = stamitz
# The command to run lilypond
LILY_CMD = lilypond -ddelete-intermediate-files \
                    -dno-point-and-click \
            -djob-count=$(NUMBER_OF_PROCESSORS)

#get the 8.3 name of CURDIR
workdir = $(shell for /f "tokens=*" %%b in ("$(CURDIR)") \
      do @echo %%~sb)

# let lilypond tell us the default midi extension
MidiExtWithQuotes = $(shell for /f "delims=() tokens=2" %%a in \
            ('lilypond -dhelp 2^>nul^|find "midi-extension"') \
            do echo %%a)

#remove all doublequotes
MidiExt = $(subst ",,$(MidiExtWithQuotes))

# The suffixes used in this Makefile.
.SUFFIXES: .ly .ily .pdf .$(MidiExt)

# 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 workdir variable which is the 8.3 version
# of the GNU make variable `CURDIR').
VPATH = \
  $(workdir)/Scores \
  $(workdir)/PDF \
  $(workdir)/Parts \
  $(workdir)/Notes

# The pattern rule to create PDF and MIDI files from a LY input file.
# The .pdf output files are created in the `PDF' subdirectory, and the
# .midi files are put into the `MIDI' subdirectory.
%.pdf %.$(MidiExt): %.ly
    $(LILY_CMD) $<
    if exist "$*.pdf"  move /Y "$*.pdf"  PDF/
    if exist "$*.$(MidiExt)" move /Y "$*.$(MidiExt)" MIDI/

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

all: score parts movements


#archive:
#    tar -cvvf stamitz.tar \
#    --exclude=*pdf --exclude=*~ \
#  --exclude=*$(MidiExt) --exclude=*.tar \
#    ../Stamitz/*

--
Jonathan Kulp
http://www.jonathankulp.com




reply via email to

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