Question

I'm trying to pass a variable from my bitbake (.bb) recipe to a Makefile that I have it calling.

In my recipe I have:

export FOO="bar"

When it runs the do_compile() method I have it calling a Makefile I generated. In the Makefile I tested the variable was set correctly via:

ifeq ($(FOO), "bar")
    echo $(FOO) >> ./test.txt
else
    echo "Didn't work" >> ./test.txt
endif

When I bake the recipe I just see "Didn't work" in the log. I thought this was very strange because if I had FOO="bar" in my Makefile and just ran make, then I would see "bar" printed in the test file. So why didn't it "pass" correctly?

I ran one more test to verify, in my Makefile I only put this line:

echo $(FOO) >> ./always_print.txt

And then after baking the recipe I see bar printed in my "always_print.txt" file yet I see "Didn't work" printed in test.txt...

Does anyone have a clue what I'm doing wrong here?

Was it helpful?

Solution 2

The make language does not use " as a quoting character, so you're comparing $(FOO) against "bar" (quotes included). Just omit the quotes:

ifeq ($(FOO),bar)
  ...

OTHER TIPS

Before defining your do_compile method, you have to define the variable EXTRA_OEMAKE which this content:

EXTRA_OEMAKE = "FOO=bar"

After that, in your do_compile method you must call 'oe_runmake'. That call invokes the command 'make', and all contents defined in EXTRA_OEMAKE variable are passed as argument to the 'make' command. Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top