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: Fri, 15 May 2009 11:52:38 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Anthony W. Youngman wrote:

parts:
      for LILYFILE in Parts/*.ly ; do $(LILY_CMD) "$$LILYFILE" ; done
      mv *.pdf $(OUTDIR)/

It works exactly as it did with the GNU wildcard, except that multiple files
can't be compiled at once with separate processors.  I'll probably stick
with the GNU wildcard approach in my personal makefiles, or else have
both lines in there with one commented out.

My bash-fu is minimal to non-existent, but couldn't you do something
like

        for LILYFILE in Parts/*.ly ; do $(LILY_CMD) "$$LILYFILE" & ;
done
        wait
        mv *.pdf $(OUTDIR)/

?

I'm sure there's a command, and I think it is "wait", that says to wait
and collect status from all the jobs you've just spawned, so the mv
wouldn't run until all the LILY_CMD commands had completed.

Cheers,
Wol

It already waits until all of the files have been run before moving them. It just loops until it has done all of the files, then proceeds to the next line and does the "mv" command.

This is irrelevant after Werner's last email using the ls command to gather the filenames, though. I like that better than the looping command, as it's easier for noobs to understand--hardly anybody, no matter how limited their command-line experience, has failed to run a "ls" command at some point, but one has to go a bit deeper to get into looping scripts. I've tried Werner's suggestion and it works beautifully:

LILY_PARTS=$$(ls Parts/*.ly)

parts:
   $(LILY_CMD) $(LILY_PARTS)
   mv *.pdf $(OUTDIR)/


I changed the ` backticks to the $() construct on recommendations from one of my scripting books, which alleges that backticks are old-fashioned. I really have no idea, but all of my scripts are done with the $() construct. Of course in the makefile it has to become $$(foo).

re: this thread--never has there been better proof that there's more than one way to skin a cat. I doubt we'll ever come up with something everyone likes. I'm learning a lot, though, so I don't mind all the conflicting suggestions. :)

Jon

p.s. most current version of multi-movement makefile example copied below...
--
Jonathan Kulp
http://www.jonathankulp.com



SHELL=/bin/sh
MASTER_FILE=stamitz
OUTDIR=PDF
VIEWER=acroread
LILY_CMD=lilypond -ddelete-intermediate-files -dno-point-and-click
LILY_PARTS=$$(ls Parts/*.ly)
LILY_MOVEMENTS=$$(ls Scores/$(MASTER_FILE)I*.ly)
PREVIEW=$(VIEWER) $(OUTDIR)/$(MASTER_FILE).pdf &

.PHONY: score movements parts midi

all: score movements parts midi

score:
        $(LILY_CMD) Scores/$(MASTER_FILE).ly
        mv $(MASTER_FILE).pdf $(OUTDIR)/
        $(PREVIEW)

movements:
        $(LILY_CMD) $(LILY_MOVEMENTS)
        mv *.pdf $(OUTDIR)/

parts:
        $(LILY_CMD) $(LILY_PARTS)
        mv *.pdf $(OUTDIR)/

midi:
        $(LILY_CMD) Scores/$(MASTER_FILE)MIDI.ly
        mv *.midi MIDI/




reply via email to

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