help-make
[Top][All Lists]
Advanced

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

Re: A question about Suffix -> no suffix rule


From: Paul Smith
Subject: Re: A question about Suffix -> no suffix rule
Date: Tue, 01 Mar 2016 18:01:30 -0500

On Wed, 2016-03-02 at 07:20 +0900, Shigio YAMAGUCHI wrote:
> This program built for i386-apple-darwin11.3.0
> $ ls
> Makefile
> $ cat Makefile
> %: %.m4
>         m4 $^ > $@
> $ touch test.html.m4
> $ make test.html
> m4 test.html.m4 > test.html
> $ touch test.c.m4
> $ make test.c
> make: *** No rule to make target `test.c'.  Stop.
> 
> Why does the build of test.c fail?

This is because you're using a "match-anything" rule and GNU make has
special operations for "match-anything" rules.  See:

http://www.gnu.org/software/make/manual/html_node/Match_002dAnything-Rules.html

In particular the last 5 or so paragraphs.

> Is there a way to make it succeed?

Well, if you don't need to create the .m4 file from another file you
can change your pattern rule to be terminal like this:

  %:: %.m4
          m4 $^ > $@

Alternatively you can run make with the -r flag to get rid of all built
-in rules, including the "special built-in dummy patterns".



reply via email to

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