GNU make not expanding Environmental Variable

29 Views Asked by At

I am trying to use a makefile but my GNU make does not seem to be expanding environment variables correctly. Using Ubuntu 22 and GNU Make v4.3, I am in a Terminal and I have a script which sets up some environment variables:

TOOLCHAIN_PATH="/opt/armc7-eabihf-glibc/bin"
TOOL_CC="arm_linux-gcc"

These both seem to be set up correctly as I can type "echo STOOLCHAIN_PATH" and it prints out the correct text string "/opt/armc7-eabihf-glibc/bin"

But now in the Makefile there is a line:

CC=$(TOOLCHAIN_PATH)/$(TOOL_CC)

and when I run make this is expanded as just /

I can confirm the environment variables are not expanding with the line:

 $(info TCP is $(TOOLCHAIN_PATH))

which simply gives me "TCP is"

Do I have to do something special to allow make to access the environmental variables that I can clearly see in the terminal before I run make ?


I tried running the settings.sh script which sets up the environmental variables correctly.

I tried running make, and the command line it generated did not have the necessary compiler name in it.

I added the line $(info TCP is $(TOOLCHAIN_PATH)), which confirmed that the variable was expanding to nothing.

0

There are 0 best solutions below