[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: transcoding recipe request
From: |
Louis-David Mitterrand |
Subject: |
Re: transcoding recipe request |
Date: |
Mon, 22 May 2006 18:04:12 +0200 |
User-agent: |
Mutt/1.5.11+cvs20060403 |
On Wed, May 10, 2006 at 03:03:52PM -0500, David Greene wrote:
> > What I need is a way of:
> >
> > - recursing into the flac directory tree,
> > - generate a target list from the flac files with patsubst
> > - another way?
> >
> > Thanks in advance for your suggestions,
>
> Off the top of my head (drawing from recent experience):
>
> # Assumes a UNIX-type environment
> $(FLACS) := $(shell find /home/ldm/music/flac -name "*.flac" -print)
>
> all: $(FLACS)
>
> /home/ldm/music/alaw/%.alaw: /home/ldm/music/flac/%.flac
> flac -cds $< | sox -S -t wav - -r 8000 -c 1 $@ resample -ql
>
> I've not tested this but it might give you a start.
Thanks!
Here is the working recipe I built from your suggestions:
FLACS := $(shell find ./flac -name "*.flac" -print)
ALAWS := $(patsubst ./flac/%.flac,./alaw/%.al,$(FLACS))
all: $(ALAWS)
./alaw/%.al: ./flac/%.flac
[ -d $(dir $@) ] || mkdir -p $(dir $@)
flac -cds $< | sox -S -t wav - -r 8000 -c 1 $@ resample -ql
Is there a way to auto-create directories as needed by targets in the
implicit rule? (thus avoiding the the -d test and mkdir)
Also I noticed filenames with whitespace produce errors in the implicit
rule. Should I apply quoting somewhere?