From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 7 11:49:11 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 196FD37B401 for ; Thu, 7 Aug 2003 11:49:11 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA3A843FA3 for ; Thu, 7 Aug 2003 11:49:07 -0700 (PDT) (envelope-from ru@sunbay.com) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) h77Imkfr050004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Aug 2003 21:48:46 +0300 (EEST) (envelope-from ru@sunbay.com) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.9/8.12.8/Submit) id h77ImkbO049999; Thu, 7 Aug 2003 21:48:46 +0300 (EEST) (envelope-from ru) Date: Thu, 7 Aug 2003 21:48:46 +0300 From: Ruslan Ermilov To: Andrew Gallatin Message-ID: <20030807184846.GB45191@sunbay.com> References: <16178.40342.11000.35373@grasshopper.cs.duke.edu> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="KFztAG8eRSV9hGtP" Content-Disposition: inline In-Reply-To: <16178.40342.11000.35373@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:49:11 -0000 --KFztAG8eRSV9hGtP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. > 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? ;-) $ make -n cc -O -pipe -march=3Dpentiumpro -c lib/foo.c cc -O -pipe -march=3Dpentiumpro -c lib/bar.c cc -O -pipe -march=3Dpentiumpro -c mcp/baz.c > ################################### > .SUFFIXES: > .SUFFIXES: .o .c >=20 > LIB=3D\ > lib/foo.c \ > lib/bar.c >=20 > MCP=3D\ > mcp/baz.c >=20 > all: $(LIB:.c=3D.o) $(MCP:.c=3D.o) >=20 > lib/%.o: lib/%.c > gcc -DLIB -c $< -o $@ >=20 > mcp/%.o: mcp/%.c > gcc -DMCP -c $< -o $@ >=20 > .PHONY: clean > clean: > rm -f $(LIB:.c=3D.o) $(MCP:.c=3D.o) > ################################### --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software Ltd, ru@FreeBSD.org FreeBSD committer --KFztAG8eRSV9hGtP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/Mp8OUkv4P6juNwoRAma3AJwPJtGNl8MYZvbcTku1iUGW1+MDIgCaAq48 dryjzMRBPUX5IiKTnBAAX4k= =Z36E -----END PGP SIGNATURE----- --KFztAG8eRSV9hGtP--