Q:

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:

But if I run it from MAKEFILE like this:
all:
    @echo 1
    @echo $(pkg-config --libs opencv)
    @echo 2

Nothing is print out, what happend?

A:

You forgot shell in your shell commands: https://www.gnu.org/software/make/manual/html_node/Shell-Function.html
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).

