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.
Thanks for looking at this, John. I've gone through the two makefiles
and updated according to your advice, and have also made changes based
on recommendations in the GNU Make Manual, such as specifying the shell
and defining unusual utilities in variables (viewer as "acroread" in
this case). I found that the only situation where && did not work in
place of ; was in the "for" loop I use in creating the parts of the
stamitz symphony.
I also added a "web" target for the lilypond-book example after
downloading the latex2html package. I'd never tried that before but it
works tolerably well, considering that you're getting completely
different output from the same source files. That was a good suggestion.
The makefiles are copied below as requested. Thanks again for your help. :)
Jon
--
Jonathan Kulp
http://www.jonathankulp.com
%%%%%%% LILYPOND-BOOK MAKEFILE %%%%%%%%%
SHELL=/bin/sh
FILE=workbook_main
OUTDIR=out
WEBDIR=htmlout
VIEWER=acroread
BROWSER=firefox
LILYBOOK_PDF=lilypond-book --output=$(OUTDIR) --pdf $(FILE).lytex
LILYBOOK_HTML=lilypond-book --output=$(WEBDIR) $(FILE).lytex
PDF=cd $(OUTDIR) && pdflatex $(FILE)
HTML=cd $(WEBDIR) && latex2html $(FILE)
INDEX=cd $(OUTDIR) && makeindex $(FILE)
PREVIEW=$(VIEWER) $(OUTDIR)/$(FILE).pdf &
all: pdf web
pdf:
$(LILYBOOK_PDF)
$(PDF)
$(INDEX)
$(LILYBOOK_PDF)
$(PDF)
$(PREVIEW)
web:
$(LILYBOOK_HTML)
$(HTML)
$(BROWSER) $(WEBDIR)/$(FILE)/$(FILE).html &
keep: pdf
cp $(OUTDIR)/$(FILE).pdf Gratis.pdf
clean:
rm -rf $(OUTDIR)
web-clean:
rm -rf $(WEBDIR)
%%%%%%%%% Makefile for Stamitz Symphony %%%%%%%%%%
SHELL=/bin/sh
FILE=stamitz
OUTDIR=PDF
VIEWER=acroread
LILY_CMD=lilypond -ddelete-intermediate-files -dno-point-and-click
MAKE_SCORE=cd Scores && $(LILY_CMD) $(FILE).ly
MAKE_PARTS=cd Parts && for LILYFILE in *.ly ; do $(LILY_CMD)
"$$LILYFILE" ; done
MAKE_MIDI=cd Scores && $(LILY_CMD) stamitzMIDI.ly
DELIVER_SCORE=mv Scores/$(FILE).pdf $(OUTDIR)/$(FILE).pdf
PREVIEW=$(VIEWER) $(OUTDIR)/$(FILE).pdf &
.PHONY: parts midi
all: score parts midi
score:
$(MAKE_SCORE)
$(DELIVER_SCORE)
$(PREVIEW)
first:
$(LILY_CMD) Scores/$(FILE)I.ly
mv $(FILE)I.pdf $(OUTDIR)/
$(VIEWER) $(OUTDIR)/$(FILE)I.pdf &
second:
$(LILY_CMD) Scores/$(FILE)II.ly
mv $(FILE)II.pdf $(OUTDIR)/
$(VIEWER) $(OUTDIR)/$(FILE)II.pdf &
third:
$(LILY_CMD) Scores/$(FILE)III.ly
mv $(FILE)III.pdf $(OUTDIR)/
$(VIEWER) $(OUTDIR)/$(FILE)III.pdf &
fourth:
$(LILY_CMD) Scores/$(FILE)IV.ly
mv $(FILE)IV.pdf $(OUTDIR)/
$(VIEWER) $(OUTDIR)/$(FILE)IV.pdf &
parts:
$(MAKE_PARTS)
mv Parts/*.pdf $(OUTDIR)/
midi:
$(MAKE_MIDI)
mv Scores/*.midi MIDI/
cd MIDI && mv stamitzMIDI.midi stamitz-I.midi && \
mv stamitzMIDI-1.midi stamitz-II.midi && \
mv stamitzMIDI-2.midi stamitz-III.midi && \
mv stamitzMIDI-3.midi stamitz-IV.midi
help:
@echo "usage: make all (build score, parts, and MIDI files)"
@echo "usage: make parts (build parts only)"
@echo "usage: make midi (build midi files only)"
@echo " "
@echo " Score and parts go to 'PDF' directory"
@echo " .midi files go to MIDI directory"
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel