Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Variable and command substitution #5

Open
legendecas opened this issue Sep 17, 2019 · 7 comments
Open

Variable and command substitution #5

legendecas opened this issue Sep 17, 2019 · 7 comments

Comments

@legendecas
Copy link

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

@kennethreitz
Copy link
Owner

use bash syntax!

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

@kennethreitz
Copy link
Owner

Leaving this open for others.

@kennethreitz kennethreitz pinned this issue Sep 17, 2019
@legendecas
Copy link
Author

legendecas commented Sep 18, 2019

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

@kennethreitz
Copy link
Owner

might need to be exported. will experiment.

@kennethreitz
Copy link
Owner

things are in a state of flux :)

@kennethreitz
Copy link
Owner

kennethreitz commented Sep 19, 2019

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
Copy link
Owner

kennethreitz commented Sep 19, 2019

Now, the following works:

CC='g++'

test:
   ${CC} foo.cc

✨ 🍰 ✨

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants