[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DOCS: include a sample "Makefile"?
From: |
peter |
Subject: |
Re: DOCS: include a sample "Makefile"? |
Date: |
Fri, 15 May 2009 14:28:29 +1000 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 MULE XEmacs/21.4 (patch 21) (Educational Television) (i486-linux-gnu) |
>>>>> "Jonathan" == Jonathan Kulp <address@hidden> 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}
- Re: DOCS: include a sample "Makefile"?, (continued)
- Re: DOCS: include a sample "Makefile"?, Peter Chubb, 2009/05/17
- Re: DOCS: include a sample "Makefile"?, Jonathan Kulp, 2009/05/17
- Re: DOCS: include a sample "Makefile"?, Werner LEMBERG, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Werner LEMBERG, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Jonathan Kulp, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Werner LEMBERG, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Jonathan Kulp, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Werner LEMBERG, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Jonathan Kulp, 2009/05/18
- Re: DOCS: include a sample "Makefile"?, Peter Chubb, 2009/05/17
- Re: DOCS: include a sample "Makefile"?,
peter <=
- Re: DOCS: include a sample "Makefile"?, John Mandereau, 2009/05/15
- Re: DOCS: include a sample "Makefile"?, Anthony W. Youngman, 2009/05/15
- Re: DOCS: include a sample "Makefile"?, Jonathan Kulp, 2009/05/15
- Re: DOCS: include a sample "Makefile"?, Patrick McCarty, 2009/05/15
- Re: DOCS: include a sample "Makefile"?, Peter Chubb, 2009/05/15
- Re: DOCS: include a sample "Makefile"?, John Mandereau, 2009/05/14
Re: DOCS: include a sample "Makefile"?, Matthias Neeracher, 2009/05/14