help-make
[Top][All Lists]
Advanced

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

RE: 3.77.3.99 vs. 3.81 and defines


From: PATTON, BILLY \(SBCSI\)
Subject: RE: 3.77.3.99 vs. 3.81 and defines
Date: Tue, 6 Jun 2006 12:19:32 -0500

I believe I may have misstated.  It is ok on 3.77 and 3.79 but fails on
3.81

Here is an example.
#<sp><sp><tab><tab>define
                define good
                        @echo "good define"
                endef
#<sp><sp><tab><tab>endef

#<tab><tab>define
                define bad
                        @echo "bad define"
                endef
#<tab><tab>endef

.PHONY : all

all :
        @echo "$@"
        @$(call good)
        @$(call bad)

> -----Original Message-----
> From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
> Sent: Tuesday, June 06, 2006 12:11 PM
> To: PATTON, BILLY (SBCSI)
> Cc: address@hidden
> Subject: Re: 3.77.3.99 vs. 3.81 and defines
> 
> 
> %% "PATTON, BILLY \(SBCSI\)" <address@hidden> writes:
> 
>   pb> But one had
>   pb> <tab><tab>define yyy
>   pb> ...
>   pb> <tab><tab>endef
> 
>   pb> The one above worked fine on 3.77 and 3.79,  but 3.81 
> crashes and says
>   pb> that it cannot find a matching endef
> 
> Hm.  "Crashes"?  Typically that means it dumps core or 
> otherwise behaves
> badly.  If that happens please definitely file a bug on 
> Savannah with a
> test case.
> 
> To know whether the above is a real error or not we'd have to see more
> details and/or a reproducible test case.  However, if the 
> behavior is as
> you say above then I suspect that this is a bug.
> 
>   pb> Now when management asks questions like :
>   pb> 1. why wasn't this a problem before?
>   pb> 2. Will it effect all the other systems still 
> configured with 3.77 and
>   pb> 3.79.
> 
>   pb> We need to know that it will not effect all production by making
>   pb> this change.  To my knowledge it should not effect anything,
>   pb> especially we will be changing a unique instance to make it like
>   pb> all others.  Do you agree?
> 
> In fact, the example above I would consider a bug in your makefile.
> Even if it seems to work.
> 
> Remember that _any_ line in a makefile that begins with a TAB is not a
> make command line, but rather a shell command script!  _ANY_ 
> line.  Make
> does not attempt to look at the contents to decide if it really looks
> like a make command or not: if the line begins with a TAB, then make
> sticks it into the command script and goes to the next line.
> 
> 
> There is one exception, mainly for backward-compatibility.  
> If there is
> no current target being defined, so that the line beginning with a TAB
> could not be part of a command script, rather than reporting a syntax
> error make will assume it's a make command line and process 
> it that way.
> 
> 
> So, in your case, AS LONG AS your defines are never in a 
> position where
> they could be considered part of a command script, prefixing them with
> TABs like this will work.
> 
> But, if someone comes along later and makes some changes so 
> that this is
> no longer true, your makefile will fail in not-so-obvious ways.
> 
> 
> Rule of thumb for make sanity: NEVER, EVER use a TAB in column 1
> ANYWHERE except within a command script.
> 
> -- 
> --------------------------------------------------------------
> -----------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  http://www.gnu.org                      http://make.paulandlesley.org
>  "Please remain calm...I may be mad, but I am a 
> professional." --Mad Scientist
> 




reply via email to

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