bake icon indicating copy to clipboard operation
bake copied to clipboard

Variable and command substitution

Open legendecas opened this issue 6 years ago • 7 comments

In Makefile we could substitute a command with an variable, and running with alternatives: make CC=clang++ test:

CC = g++
test:
  $(CC) foo.cc

Though this is related to Makefile syntax, it might still be worth to consider it. XD

legendecas avatar Sep 17 '19 11:09 legendecas

use bash syntax!

CC='g++'
test:
   ${CC} foo.cc

kennethreitz avatar Sep 17 '19 17:09 kennethreitz

Leaving this open for others.

kennethreitz avatar Sep 17 '19 18:09 kennethreitz

CC='g++'
test:
   ${CC} foo.cc

Tested on latest bake(v0.6.1) the variable was not been populated in bash environment with above Bakefile.

Anyway it could be done with:

test:
    CC='g++'
    ${CC} foo.cc

legendecas avatar Sep 18 '19 01:09 legendecas

might need to be exported. will experiment.

kennethreitz avatar Sep 18 '19 20:09 kennethreitz

things are in a state of flux :)

kennethreitz avatar Sep 18 '19 20:09 kennethreitz

This currently works!

test:
   ${CC} foo.cc

CC='g++'

Not when it's above the tasks. Should be easy to correct (need some regex or something!).

kennethreitz avatar Sep 19 '19 00:09 kennethreitz

Now, the following works:

CC='g++'

test:
   ${CC} foo.cc

:sparkles: :cake: :sparkles:

kennethreitz avatar Sep 19 '19 05:09 kennethreitz