From owner-freebsd-questions@FreeBSD.ORG Wed Apr 18 02:47:03 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 42ECA16A401 for ; Wed, 18 Apr 2007 02:47:03 +0000 (UTC) (envelope-from parv@pair.com) Received: from mta9.adelphia.net (mta9.adelphia.net [68.168.78.199]) by mx1.freebsd.org (Postfix) with ESMTP id 0095913C46A for ; Wed, 18 Apr 2007 02:47:02 +0000 (UTC) (envelope-from parv@pair.com) Received: from default.chvlva.adelphia.net ([24.126.17.68]) by mta9.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20070418024702.SANE14403.mta9.adelphia.net@default.chvlva.adelphia.net>; Tue, 17 Apr 2007 22:47:02 -0400 Received: by default.chvlva.adelphia.net (Postfix, from userid 1000) id BFD87B56A; Tue, 17 Apr 2007 22:47:15 -0400 (EDT) Date: Tue, 17 Apr 2007 22:47:15 -0400 From: Parv To: Kelly Jones Message-ID: <20070418024715.GA7211@holestein.holy.cow> Mail-Followup-To: Kelly Jones , f-q References: <26face530704171751r243ccf01sbb6d4572e8006a68@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <26face530704171751r243ccf01sbb6d4572e8006a68@mail.gmail.com> Cc: f-q Subject: Re: Loop/wildcard-like syntax for GNU make? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: f-q List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2007 02:47:03 -0000 in message <26face530704171751r243ccf01sbb6d4572e8006a68@mail.gmail.com>, 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 --