Jump to content
  • Advertisement
Sign in to follow this  

Backticks in makefiles

This topic is 3619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. This makefile
FOO = a b
BAR = `for i in $(FOO); do echo $$i.x; done`
        echo $(BAR)
outputs this:
echo `for i in a b; do echo $i.x; done`
a.x b.x
I was expecting it to output
echo a.x b.x
a.x b.x
I need the backticks to be evaluated BEFORE the variable BAR is assigned, not after. How do I do this? The reason is that I'm going to use BAR thusly:
demo: $(BAR)
So if there's a better way to get the transformed FOO into the dependency list of "demo:" then that'll do. Thanks

Share this post

Link to post
Share on other sites
Do you really need something this complicated?

Have you considered moving the shell commands to a batch file and just calling the batch file from the makefile?

Have you considered using a script to generate the makefile (if the goal here is to avoid repeating 'for' commands of a common form)?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!