help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chain pattern rules


From: Philip Guenther
Subject: Re: chain pattern rules
Date: Mon, 26 Apr 2010 20:02:22 -0700

On Mon, Apr 26, 2010 at 2:56 PM, Luke Shumaker <address@hidden> wrote:
> I'm a little confused about how chained pattern rules work, I though I
> understood it, but now I'm getting cases where make cannot figure out
> how to make my files.
>
> For example, I have a Makefile containing:
> %: %.gz; gzip -cd $< > $@
> %: %.tar; tar -xf $<
>
> If I have the file ``bash-4.1.tar.gz'' in the directory, why can't I
> type `make bash-4.1' and have it extract the tarball?  It does work if I
> type `make bash-4.1.tar' then `make bash-4.1' separately.
>
> Yes, I realize that I could just define:
> %: %.tar.gz; tar -xzf $<
>
> But this was the most simple/general example I could come up with to
> demonstrate this problem.

You're hitting the special handling of rules whose target is '%'
that's described in the info pages in "10.5.5 Match-Anything Pattern
Rules".  If you stare at that doc a bit as well as the output from
running make with the -d option, you should see why it starts working
when you mark the gzip rule as a terminal rule:

%:: %.gz; gzip -cd $< > $@
%: %.tar; tar -xf $<


Philip Guenther




reply via email to

[Prev in Thread] Current Thread [Next in Thread]