On Tue, Sep 23, 2003 at 02:42:36PM +0200, Haeusler Reinhard wrote:
> 
> I wanted to set a variable depending on another variable to different
> values.

You need to use a few tricks to do this.
I have rewritten the code you provided:
> VAR2 = $(if ??? $(VAR1), S1, s, $(if ??? $(VAR1), M, m))  # ??? means: don't

VAR2 := $(if $(filter S1,$(VAR1)),s)
VAR2 := $(if $(filter M, $(VAR1)),m,$(VAR2))

So what happens here:

The expression $(filter S1,$(VAR1)) result in 'S1' when VAR1 equals S1.
Therefore $(if select the first part, which is s.
The second line have $(VAR2) in the else clause to avoid overwriting the previously
assigned value.

You can use filter-out, filter, patsubst to obtain the same functionality.

HTH,
        Sam


_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to