Re: Loop/wildcard-like syntax for GNU make?

"Matthew Bowie" <[email protected]>
Newsgroups gmane.org.user-groups.nmlug
Message-ID <[email protected]>
Not sure if you're trying to convert a whole directory, or want to be able
to convert a specific file w/o having to specify the file.  If it's the
second case, then this should work:

%.jpg: %.gif
        convert $*.gif $*.jpg

If it's the first case, let me know and I'll see what I can come up with.

Matt



On 4/17/07, Kelly Jones < [email protected]> wrote:
>
> Here's a Makefile that converts 3 GIFs to JPGs in a given directory:
>
> 1.jpg: 1.gif
>        /usr/local/bin/convert 1.gif 1.jpg
> 2.jpg: 2.gif
>        /usr/local/bin/convert 2.gif 2.jpg
> 3.jpg: 3.gif
>        /usr/local/bin/convert 3.gif 3.jpg
>
> How do I generalize this to apply to ALL the GIFs in a given
> directory? I tried:
>
> *.jpg: *.gif
>        /usr/bin/local/bin/convert $1.gif $1.jpg
>
> but this obviously doesn't work (I didn't really expect it to). Neither
> does
>
> for $i (*.jpg) {
> $i.jpg: $i.gif
>         /usr/bin/local/bin/convert $i.gif $i.jpg
> }
>
> (again, didn't really expect it to, since you can't put shell looping
> into a Makefile).
>
> --
> We're just a Bunch Of Regular Guys, a collective group that's trying
> to understand and assimilate technology. We feel that resistance to
> new ideas and technology is unwise and ultimately futile.
> _______________________________________________
> NMLUG mailing list
> [email protected]
> http://lists.b9.com/cgi-bin/mailman/listinfo/nmlug
>



-- 
Matthew Bowie
Programmer/IT Consultant
[email protected]

_______________________________________________
NMLUG mailing list
[email protected]
http://lists.b9.com/cgi-bin/mailman/listinfo/nmlug
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.