Hello Philip,

Yes that is(.DEFAULT) is serving my purpose well. Thanks for the pointer.

What I meant by an invalid target was a target that is not to be found anywhere 
in the Makefile. I basically wanted to
replicate a shell kind of scenario whereby if the user enters an invalid option 
to the shell script program the shell script
program emits a helpful message.

In make what I seeing was a terse one-liner:
   make: *** No rule to make target `wrong_target' ***. Stop.


Thanks,
Rakesh
Sharma


> Date: Sun, 19 Aug 2012 12:33:24 -0700
> Subject: Re: generating helpful message when an invalid target specified
> From: guent...@gmail.com
> To: sharma...@hotmail.com
> CC: help-make@gnu.org
> 
> On Sat, Aug 18, 2012 at 11:31 AM, Rakesh Sharma <sharma...@hotmail.com> wrote:
> > I am a new user of Make & my question is whether is it possible to generate 
> > a help sort of a message,
> > or maybe, have a help target in the makefile,  then when an invalid target 
> > is specified, make should
> > just run the "make help" target.
> 
> I don't know what you mean by "invalid target", but the .DEFAULT
> target might be a step towards what you want.  To quote the info
> pages:
> 
> `.DEFAULT'
>      The recipe specified for `.DEFAULT' is used for any target for
>      which no rules are found (either explicit rules or implicit rules).
>      *Note Last Resort::.  If a `.DEFAULT' recipe is specified, every
>      file mentioned as a prerequisite, but not as a target in a rule,
>      will have that recipe executed on its behalf.  *Note Implicit Rule
>      Search Algorithm: Implicit Rule Search.
> 
> The downside is that you'll need to list all valid prerequisites as
> targets somewhere.
> 
> 
> Philip Guenther
                                          
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to