help-make
[Top][All Lists]
Advanced

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

Re: How to define a variable with {} expansion


From: Paul Smith
Subject: Re: How to define a variable with {} expansion
Date: Thu, 28 Jan 2021 13:06:04 -0500
User-agent: Evolution 3.36.4-0ubuntu1

On Thu, 2021-01-28 at 17:43 +0000, Cook, Malcolm wrote:
> > Thanks!  That's exactly what I was looking for. 

If it works for you that's good.

But note there are downsides to this; whether they matter to you is for
you to decide.

The first one is performance: you're invoking an entire shell process
just to do a little string manipulation.  If you only do this once per
build session obviously it's likely not a big deal.

The second one is you're relying on either (a) the underlying operating
system's /bin/sh being really bash (this is not true on, for example,
Debian and Ubuntu GNU/Linux systems), or (b) adding SHELL = /bin/bash
to your makefile which impacts all your recipes not just this.

And the third one is you need bash available in the first place, which
it may not even be on some systems, such as Windows for example.

Using make built-in string manipulation functions doesn't have any of
these concerns.

People should use what works best for them, of course, I'm just filling
in the blanks :)


> > On Thu, Jan 28, 2021 at 12:50 AM Cook, Malcolm <mailto:
> > MEC@stowers.org> wrote:
> > This is called “brace expansion” in bash manual.
> >  
> > If you are using a newer version of Gnu Make, and Make’s .SHELL is
> > set to /bin/bash (or another shell which supports brace expansion),
> > you can use Make’s new-ish “shell assignment operator”, !=, like
> > this
> >  
> >                 x!= echo abc/def/{ghi,kln,opq}.a




reply via email to

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