On Thu, 5 Dec 2002, Tzafrir Cohen wrote:

> On Thu, 5 Dec 2002, guy keren wrote:
> 
> >
> > Makefiles should not be medled with. if you try to do something
> > complicated - most likely you'll fail, cause the language that gmake (and
> > the commercial 'make' variants) supports - are very very limited.
> 
> A chalange, then, ha?

not realy - gnu make's language realy _is_ very limited. every once in a 
while i try to enhance the Makefile of the project i work on (been using 
gnu make for such things since around 97 - so i thought i should be able 
to do what i want with it) - and eventually fall back to using cut and 
paste, external aliases and scripts and the like - because of the limits 
of its language, and the lack of a proper debugger (or proper error 
messages).

> (reading the gnu-make manual)

so did i yet again before i wrote my previous post ;)

> Well, the best I could find was: "target-spesific values"
> 
>      There is one more special feature of target-specific variables: when
>   you define a target-specific variable, that variable value is also in
>   effect for all prerequisites of this target (unless those prerequisites
>   override it with their own target-specific variable value).  So, for
>   example, a statement like this:
> 
>      prog : CFLAGS = -g
>      prog : prog.o foo.o bar.o
> 
>   will set `CFLAGS' to `-g' in the command script for `prog', but it will
>   also set `CFLAGS' to `-g' in the command scripts that create `prog.o',
>   `foo.o', and `bar.o', and any command scripts which create their
>   prerequisites.
> 
> So how about:
> 
>   ppc: ARC=PPC
>   ppc: release
> 
>   release:
>       ifeq ($(ARCH),PPC)
> (is that the right syntax?)

tzafrir, if you want a challenge - then _try_ what you write. it does not 
work and will not work, because of a simple reason - the given variable is 
being defined ONLY inside the commands of the rule. this 'ifeq' is NOT 
part of the commands for the rule - since it is a gnu make command. the 
'commands of the rule', as i perceive the term now, are only the _shell_ 
commands of the rule.

> The problem is that 'release' has to be a pre-requirement of ppc.

the problem is - this does not work as you think it does ;)

> But then-again, recursive makes are not much nicer.

but at least they can be understood, and they do work.

--
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to