0

This is the strangest behaviour I have ever seen. I know you might be shocked to see the below explanation but yes this is happening.

I'm trying to export a variable name which is LON_GEMINI_BOX from a bash script.

And trying to access the value of this variable in a makefile to define some specific things.

which looks like: In bash script,

export LON_GEMINI_BOX = 1

In makefile,

ifeq ($(LON_GEMINI_BOX), 1)
This is how im defined
EXTRA_CFLAGS += 
EXTRA_CFLAGS += 
else
why is this happening
endif

I always end up in else part while building. If I just tweak variable name to LON_GEMINI1_BOX or anything else other than LON_GEMINI_BOX it is exported and works as expected.

I'm struggling to identity what is the problem.

closed as unclear what you're asking by Gilles, user79743, Jeff Schaller, Wildcard, Scott Feb 10 '16 at 3:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    LON_GEMINI_BOX = 1 does not work in bash; you need LON_GEMINI_BOX=1 – Hauke Laging Feb 9 '16 at 10:10
  • Sorry! about the typo. but still doesn't work with LON_GEMINI_BOX=1 – Sunil R Feb 9 '16 at 10:15
  • You should edit your question and correct typos... – Hauke Laging Feb 9 '16 at 10:42
  • 1
    Edit your question to put your actual, complete code. Until you do this, we can't help you. – Gilles Feb 9 '16 at 22:31
1

Recommend eliminating all blanks in makefile conditionals. See this makefile, which works perfectly.

TXT="--"
ifeq ($(LON_GEMINI_BOX),1)
 TXT="works!"
 EXTRA_CFLAGS +=
 EXTRA_CFLAGS +=
else
 TXT="why is this happening"
endif
all:
    @echo $(TXT)
  • The problem is just by changing the name it starts working, with same name it doesn't work. I feel there is something specific to the name. Could there be anywhere the export of such names blocked. – Sunil R Feb 9 '16 at 10:32
  • I have searched the entire source to see if this variable name is unset any where else. but does not seem so. – Sunil R Feb 9 '16 at 10:33
  • 1
    sorry somewhere else the same variable was defined like below and fixed it LON_GEMINI_BOX=y. Thanks for all your responses. – Sunil R Feb 9 '16 at 11:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.