Date: Thu, 7 Aug 2003 21:55:42 +0300 From: Ruslan Ermilov <ru@freebsd.org> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-hackers@freebsd.org Subject: Re: BSD make question Message-ID: <20030807185542.GC45191@sunbay.com> In-Reply-To: <16178.40843.224377.273862@grasshopper.cs.duke.edu> References: <16178.40342.11000.35373@grasshopper.cs.duke.edu> <20030807184846.GB45191@sunbay.com> <16178.40843.224377.273862@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Thu, Aug 07, 2003 at 02:50:51PM -0400, Andrew Gallatin wrote: > > Ruslan Ermilov writes: > > On Thu, Aug 07, 2003 at 02:42:30PM -0400, Andrew Gallatin wrote: > > > > > > Using BSD make, how can I apply different rules based on different > > > directories while using only a single makefile? > > > > > There's a .CURDIR variable that can be used to conditionalize > > parts of a makefile. > > > > > Ie, the appended Makefile results in the following compilations: > > > > > > 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 > > > > > > Is it possible to do something similar with BSD make? > > > > > It just works "as is" with bmake. What's your problem, Drew? ;-) > > > > $ make -n > > cc -O -pipe -march=pentiumpro -c lib/foo.c > > ;) But its missing the -DLIB or -DMCP. > > Thanks for the .CURDIR hint. > Ah, didn't notice it. Try this: .for f in $(LIB) $(f:.c=.o): $(f) gcc -DLIB -c $< -o $@ .endfor .for f in $(MCP) $(f:.c=.o): $(f) gcc -DMCP -c $< -o $@ .endfor Cheers, -- Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software Ltd, ru@FreeBSD.org FreeBSD committer [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/MqCuUkv4P6juNwoRAvXDAJ4rp8/sAuusy27xlrl8iCN0s35mNACfUNas lVBqO0XUciD7ZQUxOP4rDEM= =wUOd -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030807185542.GC45191>
