help-make
[Top][All Lists]
Advanced

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

RE: generating helpful message when an invalid target specified


From: Rakesh Sharma
Subject: RE: generating helpful message when an invalid target specified
Date: Sun, 19 Aug 2012 21:40:13 -0700

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: address@hidden
> To: address@hidden
> CC: address@hidden
> 
> On Sat, Aug 18, 2012 at 11:31 AM, Rakesh Sharma <address@hidden> 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
                                          

reply via email to

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