红联linux Linux通用技术 - Linux发行版技术 - 企业应用 - 实验室  Linux论坛

您的位置: 红联linux >> Linux通用技术 >>

Linux编程与内核

>> 查看内容 -学Linux必读Linux学习教程推荐下载发新话题 (游客可发贴)

求助我在linux编程是遇到了makefile使用了环境变量

心弦linux发布于 2015-10-17 | 次阅读   字号:     (网友评论 0 条) 我要评论


我在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

请求各位大拿指点!小弟不胜感激!

 我要评论
发表评论,与各位同人交流。回复请点击下方的我要评论按钮(游客可回复),要发表贴子请点击 发新话题 (游客可发贴)
 热点主题
·是什么原因cat不到内容呢,
 最新主题
·是什么原因cat不到内容呢,
 关注热点

Linux教程下载?
Linux学习教程推荐下载”(请点击),Linux教程免费下载。

求助Linux问题?
论坛有39版块,覆盖所有Linux技术层面。前往“红联Linux论坛

 

Linux系统教程 | Linux入门 | Linux管理 | Linux技巧 | Linux命令 | Ubuntu系统 | Linux服务器 | Linux数据库 | Linux开发

合作 | 关于我们 | 联系我们 | 导航 | 会员注册

©2017 红联 Powered by SupSite