我在linux编程是遇到了makefile使用了环境变量来定位头文件的问题!因为接触的不太多所以请大拿为我解惑一下给出我makefile引用的环境变量的脚本如下:
basic path
HOME_SC = /www/work/tt
#home base include dir
HOME_BASE_INC = $(HOME_SC)/base
#home server include dir
HOME_SERVER_INC = $(HOME_SC)/server
#home server bin dir
HOME_SERVER_BIN = $(HOME_SC)/om/server
###############################################################################
###############################################################################
#server include dir
SERVER_INC = $(HOME_SERVER_INC)/include
###############################################################################
###############################################################################
#client & server public base include path
#output include dir
OUTPUT_INC = $(HOME_BASE_INC)/include
#output include base dir
OUTPUT_CORE_INC = $(HOME_BASE_INC)/include/Core
OUTPUT_CONF_INC = $(HOME_BASE_INC)/include/Conf
OUTPUT_LCORE_INC = $(HOME_BASE_INC)/include/LCore
OUTPUT_LUAEXT_INC = $(HOME_BASE_INC)/include/LuaExt
OUTPUT_MAP_INC = $(HOME_BASE_INC)/include/Map
OUTPUT_NET_INC = $(HOME_BASE_INC)/include/Net
OUTPUT_PICMGR_INC = $(HOME_BASE_INC)/include/PicMgr
OUTPUT_LUA_INC = $(HOME_BASE_INC)/include/lua
OUTPUT_ZLIB_INC = $(HOME_BASE_INC)/include/zlib
###############################################################################
###############################################################################
#mysql include dir
MYSQL_INC = /usr/local/mysql/include/mysql
MYSQL_INC2 = /www/wdlinux/mysql-5.1.69/include/mysql
###############################################################################
###############################################################################
#all include dir
ALL_INC = $(OUTPUT_INC) $(SERVER_INC) $(OUTPUT_CORE_INC) $(OUTPUT_CONF_INC) $(OUTPUT_LCORE_INC) $(OUTPUT_LUAEXT_INC) $(OUTPUT_MAP_INC) $(OUTPUT_NET_INC) $(OUTPUT_PICMGR_INC) $(OUTPUT_LUA_INC) $(MYSQL_INC) $(MYSQL_INC2) $(OUTPUT_ZLIB_INC)
###############################################################################
###############################################################################
#output lib dir
OUTPUT_LIB = $(HOME_SERVER_BIN)/base/lib
#epoll lib dir
EPOLL_LIB = $(HOME_SERVER_BIN)/server/lib
#mysql lib dir
MYSQL_LIB = /usr/local/mysql/lib/mysql
MYSQL_LIB2 = /www/wdlinux/mysql-5.1.69/lib/mysql
#all lib dir
ALL_LIB = $(OUTPUT_LIB) $(EPOLL_LIB) $(MYSQL_LIB) $(MYSQL_LIB2)
###############################################################################
然后给出我自己做的变量如下:
HOME_SC=/www/work/sc2
export HOME_SC
HOME_BASE_INC=$(HOME_SC)/base
export HOME_BASE_INC
HOME_SERVER_INC=$(HOME_SC)/server
export HOME_SERVER_INC
HOME_SERVER_BIN=$(HOME_SC)/om/server
export HOME_SERVER_BIN
SERVER_INC=$(HOME_SERVER_INC)/include
export SERVER_INC
OUTPUT_INC=$(HOME_BASE_INC)/include
export OUTPUT_INC
OUTPUT_CORE_INC=$(HOME_BASE_INC)/include/Core
export OUTPUT_CORE_INC
OUTPUT_CONF_INC=$(HOME_BASE_INC)/include/Conf
export OUTPUT_CONF_INC
OUTPUT_LCORE_INC=$(HOME_BASE_INC)/include/LCore
export OUTPUT_LCORE_IN
OUTPUT_LUAEXT_INC=$(HOME_BASE_INC)/include/LuaExt
export OUTPUT_LUAEXT_INC
OUTPUT_MAP_INC=$(HOME_BASE_INC)/include/Map
export OUTPUT_MAP_INC
OUTPUT_NET_INC=$(HOME_BASE_INC)/include/Net
export OUTPUT_NET_INC
OUTPUT_PICMGR_INC=$(HOME_BASE_INC)/include/PicMgr
export OUTPUT_PICMGR_INC
OUTPUT_LUA_INC=$(HOME_BASE_INC)/include/lua
export OUTPUT_LUA_INC
OUTPUT_ZLIB_INC=$(HOME_BASE_INC)/include/zlib
export OUTPUT_ZLIB_INC
MYSQL_INC=/usr/local/mysql/include/mysql
export MYSQL_INC
MYSQL_INC2=/www/wdlinux/mysql-5.1.69/include/mysql
export MYSQL_INC2
ALL_INC=$(OUTPUT_INC) $(SERVER_INC) $(OUTPUT_CORE_INC) $(OUTPUT_CONF_INC) $(OUTPUT_LCORE_INC) $(OUTPUT_LUAEXT_INC) $(OUTPUT_MAP_INC) $(OUTPUT_NET_INC) $(OUTPUT_PICMGR_INC) $(OUTPUT_LUA_INC) $(MYSQL_INC) $(MYSQL_INC2) $(OUTPUT_ZLIB_INC)
export ALL_INC
OUTPUT_LIB=$(HOME_SERVER_BIN)/base/lib
export OUTPUT_LIB
EPOLL_LIB=$(HOME_SERVER_BIN)/server/lib
export EPOLL_LIB
MYSQL_LIB=/usr/local/mysql/lib/mysql
export MYSQL_LIB
MYSQL_LIB2=/www/wdlinux/mysql-5.1.69/lib/mysql
export MYSQL_LIB2
ALL_LIB=$(OUTPUT_LIB) $(EPOLL_LIB) $(MYSQL_LIB) $(MYSQL_LIB2)
export ALL_LIB
请求各位大拿指点!小弟不胜感激!