Re: Loop/wildcard-like syntax for GNU make?
in message <[EMAIL PROTECTED]>, wrote Kelly Jones thusly... Would you mind cutting the number of mailing lists? I think a|any technical list would have been enough. Anyway ... > 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 > } Following worked with both BSD & GNU make 3.81 (mind the tabs|spaces)... # Makefile all: @for i in 1 2 3;\ do \ echo "i: $$i";\ done ... so some version of body of a target below should work for you (mind the spaces|tabs) ... @cd "$$image_dir";\ for f in *.gif;\ do \ new=$( basename "$$f" '.gif' )'.jpg';\ convert "$$f" "$$new";\ done - Parv -- ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Loop/wildcard-like syntax for GNU make?
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. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"