bug-make
[Top][All Lists]
Advanced

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

Question about GNU Make


From: Margalit, Sivan
Subject: Question about GNU Make
Date: Mon, 21 May 2001 09:45:54 -0400

Hello
I have a problem to define variable assignment per target.
Requirements:
        all_targets = target1 target2 
        for target1 set variable a = val1 
            for target2 set variable a = val2
        all_target:
                call $@ a .....

In make manual chapter "Target-specific Variable values" I found:
        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. 

I think This is what I need. But When I tried to implement it I got an error
message " no rule for CFLAGS needed for target prog"

I will appriciate your help: 
Where did I wrong? Why does make treat CFLAG as depend, instead variable
assignment?

Thanks in advance
Sivan Margalit
Dialogic Israel Ltd.
Phone: 972-4-9105036
Fax: 972-4-9105001




reply via email to

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