On Mon, Apr 26, 2010 at 2:56 PM, Luke Shumaker <[email protected]> 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 _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
