Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants