gnu.gcc.help
[Top] [All Lists]

Basic question about access environment variable in makefile

Subject: Basic question about access environment variable in makefile
From: Bill David
Date: Tue, 9 Sep 2008 04:43:43 -0700 PDT
Newsgroups: gnu.gcc.help

I am trying to port my Windows program to Linux. Then I begin to write
makefile. But I meet a problem: I can't access environment variable in
the makefile. I have searched a lot but find no result.
In some documents, it says, in makefile, we can use environment
variable, but how?

I have tried (to environment variable XXX):
$XXX
$$XXX
$${XXX}
it always doesn't work.

I have added a variable in the makefile
INCLUDE_FLAGS := -I$$THREADPOOL_DIR/include
and the following is the overrided default rule:
%.o : %.cpp
        $(FileModule_CXX) $(FileModule_CXXFLAGS) $(INCLUDE_FLAGS) $< -
c -o $@

which will refer to the INCLUDE_FLAGS.
But when I make the program, it always complain, can't find header
file which exactly exists in directory:
$THREADPOOL_DIR/include

and I can cd to above directory in shell by:
cd $THREADPOOL_DIR/include

<Prev in Thread] Current Thread [Next in Thread>