help-make
[Top][All Lists]
Advanced

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

Re: match-anything rule takes precedence over earlier rule


From: Johan Bezem
Subject: Re: match-anything rule takes precedence over earlier rule
Date: Wed, 15 Jan 2003 10:20:42 +0100

AFAIK, the "% : error" rule says, that all targets are depending on the
'error' target, so that is built first. The manual says:
> There can only be one set of commands to be executed for a file. If more
> than one rule gives commands for the same file, make uses the last set
> given and prints an error message.
This is what you see, except for the error message; but then, maybe your
'exit' prevents the error message being printed.
Please remove the 'exit', and if necessary, use '-d' to see waht's going on.
Maybe you should consifer using double-colon rules for this, depending on
what you want to achieve with the %-rule.

Regards,

Johan Bezem
CSK Software AG

gk wrote:
> 
> I do not understand why the following makefile will not build the second
> target.
> I thought the explicit rule should take precedence over a match-anything
> rule, especially since it appears earier in the makefile. Thanks for any 
> clues.
> 
> # makefile
> # .PHONY directive makes no difference regarding this problem
> .PHONY: error project
> 
> error :
>          @echo 'rule: $@'
>          @echo type "'make project'"
>          @exit 1
> 
> # this target cannot be made:
> project :
>          @echo 'rule: $@'
> 
> # if this final rule is removed, it works fine
> % : error
>          @echo this will never print
> #eof
> 
> address@hidden junk]$ make project
> rule: error
> type 'make project'
> make: *** [error] Error 1
> 
> - Greg Keraunen
> 
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make




reply via email to

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