help-make
[Top][All Lists]
Advanced

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

Re: Substring function (GMSL)


From: Michael Ludwig
Subject: Re: Substring function (GMSL)
Date: Sun, 19 Aug 2012 23:13:46 +0200
User-agent: Mutt/1.5.21+52 (c26dbc7021f4) (2011-07-01)

Oleksandr Gavenko schrieb am 26.07.2012 um 22:26 (+0300):
> On 2012-07-14, Michael Ludwig wrote:
> 
> > VPATH = 01-eins 02-zwei 03-drei 11-elf
> >
> > What could I do to transform the VPATH input list
> > such as to obtain the following output list?
> >
> > EXEN = eins.exe zwei.exe drei.exe elf.exe
> >
> > (Strip the leading number and add the suffix.)
> >
> As you can see this task is not indented to be solved in GNU Make in
> natural way.
> 
> If you have such task in real project this show that you give wrong
> names to project files, etc (in case of Makefile ideology).

Guess you're right. Better to avoid the problem in the first place by
going with the flow and not against the grain.

> In such situation I use cache technique and real shell scripts, like:
> 
>   old := 01-xxx 02-yyy 002-zzz
> 
>   -include Makefile.vars
> 
>   .PHONY: Makefile.vars
>   Makefile.vars:
>       { \
>     printf 'new :='; \
>     for i in $(old); do printf " "$${i#*-}.exe; done; \
>     echo; \
>   } >$@

This is funky … thanks.

> I try make string manipulation in plain sh to avoid creation of
> another process. Note that printf and echo are shell built-in for
> most shells...

I'm a Windows user, here's a dummy script to prove it also works there:

include moin.mak

bla := 01-xxx 02-yyy 002-zzz

.PHONY: moin.mak
moin.mak:
        ( for %%d in ( $(bla) ) do @echo %%d: && echo   dir /b ^> $$@ ) > $@

> If you consider that GMSL is useful look to author articles at:
> 
>   http://www.cmcrossroads.com/ask-mr-make
> 
> for in-depth GNU Make tips.

Yes, useful collection, thanks!
-- 
Michael Ludwig



reply via email to

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