Re: gmake question

From: Alexis Huxley (ahuxley_at_gmx.net)
Date: 10/28/04


Date: Thu, 28 Oct 2004 19:08:03 +0200


> I would expect it to be done in the following way:
>
> PRINT_B=NO
>
> xxx:
> ( \
> echo a; \
> ifeq ($(PRINT_B),YES)
> echo b; \
> endif
> echo c; \
> ) > xxx
>
> The problem is that ifeq and endif is interpreted by shell and not by make file.

Which doesn't understand them.

So use shell's own 'if' (not tested)

        xxx:
                ( \
                        echo a; \
                        if [ "$(PRINT_B)" = YES ]; then \
                             echo b; \
                        fi; \
                        echo c; \
                ) > xxx

Alexis



Relevant Pages