linux driver compile error, cannot use $(shell pwd)/xxx as include path
When I compile my linux drive, I find a problem:
I have some ways to define the include path
A relative path by $(shell pwd), but it doesn't work:
MOD_INC=$(shell pwd)/include
EXTRA_CFLAGS+=-I$(MOD_INC)
I found: $(shell pwd) == /home/myname/prj_svn
B abosulte path, it works:
MOD_INC=/home/myname/prj_svn/include
EXTRA_CFLAGS+=-I$(MOD_INC)
C define a path, it works:
PRJ_PATH=/home/myname/prj_svn
MOD_INC=$(PRJ_PATH)/include
EXTRA_CFLAGS+=-I$(MOD_INC)
I don't know why?
I try them in 开发者_如何转开发an application project, all of them can work.
thanks for your help!
Make does quite a lot of directory changing as it builds; i wouldn't want to rely on the value of pwd
at any particular point in time.
How about defining an environment variable called something like MODULE_HOME
, set to /home/myname/prj_svn
, and writing all your paths relative to that?
精彩评论