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: Anthony W. Youngman
Subject: Re: DOCS: include a sample "Makefile"?
Date: Sat, 16 May 2009 11:32:53 +0100
User-agent: Turnpike/6.05-U (<E1Z6TVzMPTSvF3mvHWX+2+b$k4>)

In message <address@hidden>, Jonathan Kulp <address@hidden> writes
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.

I think you missed the "&" in my code :-)

If the "wait" isn't there, the mv will fail because there won't be any *.pdf files for it to move. Werner's point about multiple invocations of lilypond is very valid, but on a multi-processor machine my technique will use all processors. It'll probably be a bit slower on a uni-processor, though.

To explain ... let's say there are 10 lily files to process, each of which takes maybe 30 secs? My bash-fu thinks this technique will run lily 10 times, once for each file. WITHOUT the ampersand, the 10 instances run in sequence, taking 5 minutes, and then the code moves on to the mv. WITH the ampersand, all ten instances are fired off at once, taking maybe 15 seconds, and then the code moves on to the next line. If that's the 'mv', then it won't find any pdfs! That's the point of the "wait" - to say "wait until all the lilys have finished before carrying on".

Cheers,
Wol
--
Anthony W. Youngman - address@hidden





reply via email to

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