user2447581 user2447581 - 1 year ago 165
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

Answer Source

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).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download