user2447581 user2447581 - 2 months ago 4
C++ Question

Linux MAKEFILE access environment variable

I install OpenCV library in Linux. If I run command:

echo $(pkg-config --libs opencv)

The result is as follow:
enter image description here

But if I run it from MAKEFILE like this:

@echo 1
@echo $(pkg-config --libs opencv)
@echo 2

Nothing is print out, what happend?
enter image description here


You forgot shell in your shell commands:

Try this:

@echo $(shell pkg-config --libs opencv)

With it, you were printing the value of a variable named pkg-config (or something like that).