>>>>> "Jonathan" == Jonathan Kulp <[email protected]> writes:
Jonathan> John Mandereau wrote:
>> Jonathan Kulp a écrit :
>>> I would welcome "best practice" advice on these. Once I'm
>>> satisfied with how they work on Linux & Mac (and Windows if anyone
>>> wants to help me with them), then I'll put generic filenames and
>>> dirnames to change them into examples suitable for the
>>> documentation.
>> Make always invokes a new shell for each command line (except that
>> you can split a shell command or commands sequence on several lines
>> with '\'), so you don't need the 'cd ..'
>>
>> Prefer '&&' over ';' as a command separator, except if you don't
>> care whether the first command fails for the execution of the
>> second command. In this case, if for some reason there is no 'out'
>> directory, you will get a less explicit error than if the shell
>> (and then make) would have returned an error "out: no such file or
>> directory".
>>
>> It might be good to separate commands for generating each
>> intermediate formats, e.g. in case you define targets or variables
>> that can enable different output format from the latex file (PDF,
>> HTML with latex2html, ...).
>>
>> Best, John
>>
>> PS please attach or quote in the message future revisions of this
>> makefile directly, so lazy hackers can grab and comment it more
>> easily.
>>
Jonathan> Thanks for looking at this, John. I've gone through the two
Jonathan> makefiles and updated according to your advice, and have
Jonathan> also made changes based on recommendations in the GNU Make
Jonathan> Manual, such as specifying the shell and defining unusual
Jonathan> utilities in variables (viewer as "acroread" in this case).
Jonathan> I found that the only situation where && did not work in
Jonathan> place of ; was in the "for" loop I use in creating the parts
Jonathan> of the stamitz symphony.
Why not use some automatic rules, like so:
Then your Makefile becomes something like:
piece= stamitz
SUFFIXES: .ly .pdf .view
.ly.pdf:
${LILY} $<
all: score parts midi
score: ${piece}.pdf
parts: Parts/${piece}I.pdf Parts/${piece}II.pdf
.view.pdf:
${PDFVIEWER} $*.pdf
If you use GNU extensions, then here's the Makefile I generally use,
to convert everything in the current directory.
---
LYFILES:=${wildcard *.ly}
TEXFILES:=${wildcard *.tex}
PSFILES:=${LYFILES:.ly=.ps} ${TEXFILES:.tex=.ps}
PDFFILES:=${PSFILES:.ps=.pdf}
MIDIFILES:=${LYFILES:.ly=.midi}
LATEX:=latex
LILY:=lilypond
CONVERT:=convert-ly
OUTDIR:=outdir
PS2PDF:= ps2pdf
all: ${PSFILES}
%.ps %.midi %.pdf: %.update
${LILY} $*.ly
%.update: %.ly
${CONVERT} -e $<
%.ps: %.tex
-[ -d ${OUTDIR} ] && rm -rf ${OUTDIR}
mkdir -p ${OUTDIR}
lilypond-book -o outdir -f latex $*.tex
( cd outdir; latex $*.tex && dvips -Ppdf -u +lilypond.map -o ../$@
$*.dvi; )
%.pdf: %.ps
${PS2PDF} $<
clean:
rm -f ${PSFILES} ${PDFFILES} ${MIDIFILES}
rm -rf ${OUTDIR}
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel