-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike Frysinger wrote:
> is it possible to search for a comma using $(findstring) ?  i tried escaping 
> it with no luck :(
> 
> test:
>       echo $(findstring -Wl,moo,$(LDFLAGS))
> 
> which obviously behaves like:
>       find = -Wl
>       in = moo,$(LDFLAGS)
> 
> this also fails:
>       echo $(findstring -Wl\,moo,$(LDFLAGS))
> 
> the best i have is:
> MOO = -Wl,moo
> $(findstring $(MOO),$(LDFLAGS))

Firstly, escaping in GNU Make doesn't work (most of the time :-) and so
what you are trying to do looks good, but doesn't do anything.

You will need to define a variable that contains the comma.   Since GNU
Make has incredibly liberal variable naming it's possible to do the
following:

    ,:=,

That defines a variable called , which has the value ,.   You can use
this variable by writing $(,) anywhere you need a comma.  Since GNU Make
also has the short form variable expansion ($(a) can be written $a) that
means you can get a comma by writing $, and if you close your eyes you
can pretend that's an escape sequence :-)

So your example could be written:

    , := ,

    test:
        echo $(findstring -Wl$(,)moo,$(LDFLAGS))

(You can't use the $, contraction here because of the way that argument
splitting is done by GNU Make, pity :-)

John.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGdoPELphrp73n/hARAmEFAKDTs08PxsqlucmDC/iamM1zvXYTtgCeNoAu
1yzoZ2/KhEDmBc32dm7zB2s=
=NSiV
-----END PGP SIGNATURE-----


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to