From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 7 11:56:20 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDA9937B401 for ; Thu, 7 Aug 2003 11:56:20 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6160E43FA3 for ; Thu, 7 Aug 2003 11:56:15 -0700 (PDT) (envelope-from ru@sunbay.com) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) h77Ithfr050709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Aug 2003 21:55:44 +0300 (EEST) (envelope-from ru@sunbay.com) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.9/8.12.8/Submit) id h77Ithh5050704; Thu, 7 Aug 2003 21:55:43 +0300 (EEST) (envelope-from ru) Date: Thu, 7 Aug 2003 21:55:42 +0300 From: Ruslan Ermilov To: Andrew Gallatin Message-ID: <20030807185542.GC45191@sunbay.com> References: <16178.40342.11000.35373@grasshopper.cs.duke.edu> <20030807184846.GB45191@sunbay.com> <16178.40843.224377.273862@grasshopper.cs.duke.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iFRdW5/EC4oqxDHL" Content-Disposition: inline In-Reply-To: <16178.40843.224377.273862@grasshopper.cs.duke.edu> User-Agent: Mutt/1.5.4i cc: freebsd-hackers@freebsd.org Subject: Re: BSD make question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2003 18:56:21 -0000 --iFRdW5/EC4oqxDHL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 07, 2003 at 02:50:51PM -0400, Andrew Gallatin wrote: >=20 > Ruslan Ermilov writes: > > On Thu, Aug 07, 2003 at 02:42:30PM -0400, Andrew Gallatin wrote: > > >=20 > > > Using BSD make, how can I apply different rules based on different > > > directories while using only a single makefile? > > >=20 > > There's a .CURDIR variable that can be used to conditionalize > > parts of a makefile. > >=20 > > > Ie, the appended Makefile results in the following compilations: > > >=20 > > > gcc -DLIB -c lib/foo.c -o lib/foo.o > > > gcc -DLIB -c lib/bar.c -o lib/bar.o > > > gcc -DMCP -c mcp/baz.c -o mcp/baz.o > > >=20 > > > Is it possible to do something similar with BSD make? > > >=20 > > It just works "as is" with bmake. What's your problem, Drew? ;-) > >=20 > > $ make -n > > cc -O -pipe -march=3Dpentiumpro -c lib/foo.c >=20 > ;) But its missing the -DLIB or -DMCP. >=20 > Thanks for the .CURDIR hint. >=20 Ah, didn't notice it. Try this: =2Efor f in $(LIB) $(f:.c=3D.o): $(f) gcc -DLIB -c $< -o $@ =2Eendfor =2Efor f in $(MCP) $(f:.c=3D.o): $(f) gcc -DMCP -c $< -o $@ =2Eendfor Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software Ltd, ru@FreeBSD.org FreeBSD committer --iFRdW5/EC4oqxDHL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/MqCuUkv4P6juNwoRAvXDAJ4rp8/sAuusy27xlrl8iCN0s35mNACfUNas lVBqO0XUciD7ZQUxOP4rDEM= =wUOd -----END PGP SIGNATURE----- --iFRdW5/EC4oqxDHL--