UC故事2011/12/17 build系统研究


1. Make知识总结

* 特殊变量

$@:代表目标全名,含后缀

$*:目标名,不含后缀

$<:第一个相关目标名


* 自动产生Makefile文件:autotools

·  aclocal
·  autoscan
·  autoconf
·  autoheader
·  automake


例子:自动生成hellworld.c的makefile

step1: autoscan -> configure.scan -> configure.in

step2: vi configure.in,一些变量定义

step3: aclocal -> aclocal.m4

step4: autoconf

step5: vi makefile.am

step6: automake --add-missing

step7: ./configure

step8: make

step9: ./helloworld


2. gcc/g++开关

-Wpointer-arith

-pipe

-dl

-fPIC = Position Independent Code 2012/04/09


3. Make系统分析

* all_in_one.make

ifdef USER_DEPTH
  SRC_ROOT = $(USER_DEPTH)
  include $(SRC_ROOT)/config/makeinclude/macros.make
  include $(SRC_ROOT)/config/makeinclude/rules.make
else
  all clean: echo_error
endif # USER_DEPTH

echo_error:
        @echo "Error, Makefile must define USER_DEPTH."

* platform.make

用途:一些开关量与宏的定义

debug = 1
optimize = 1
profile = 0
disable_assert=1
leak_check = 0
flow_control = 1
exceptions = 1
threads = 1

Q:以上开关干嘛用的?


4. build info server

g++ -Wall -Wpointer-arith -pipe -D_REENTRANT -D_GNU_SOURCE -Wall -Wpointer-arith -pipe -D_REENTRANT -D_GNU_SOURCE -g -g -g -g -O3 -O3 -DRT_UNIX  -DRT_LINUX -DRT_UNIX  -DRT_LINUX -D__MYSQL__ -D_Support_Dump_ -DSNMP_SUPPORT -D__INFO_ENABLE_FLOW_CONTROL__  -DRT_DEBUG -DRT_DISABLE_ASSERTE -I../../../src/util/h -I../../../src/h -I../../../src/common/h -I../../../src/Server/InfoSvr4.2/gcc -I../../../src/Server/InfoSvr4.2/mcs -I../../../src/Server/InfoSvr4.2/sdd -I../../../src/Server/InfoSvr4.2/h -I../../../src/Server/InfoSvr4.2/application -I../../../h -I../../../src/Server/h -I../../../src/Server/common -I../../../src/Server/InfoSvr4.2/ServerInternalPdu -I../../../src/Server/InfoSvr4.2/application -I/usr/include/mysql -I../../../src/Server/messageBus -I../../../src/Server/SvrConfProxy -I../../../src/Server/PSTN/TelephoneMeeting         -o ../../../bin/InfoServer ../../../bin/Server/InfoServer/InfoServer.o ../../../bin/Server/InfoServer/InfoSvrConfigLoader.o  -ldl -lpthread -lrt -ldl -lpthread -lrt ../../../bin/libgcc.a ../../../bin/libapplication.a ../../../bin/libInfoTelMeeting.a ../../../bin/libmcs.a ../../../bin/libsdd.a ../../../bin/libsdcommon.a ../../../bin/libfilemanager.a ../../../bin/libinfosessioncommon.a ../../../bin/libSvrConfProxy.a ../../../bin/libmessagebus.a ../../../bin/libinfofilecache.a ../../../bin/libconnmgr.a ../../../bin/libdblog.a  ../../../bin/libs/libaudiocodec32.a ../../../bin/libsecurity.a ../../../bin/libnetwork.a ../../../bin/libframework.a  -lmysqlclient -lz -L/usr/local/mysql/lib/mysql
../../../bin/Server/InfoServer/InfoServer.o: In function `LoadMixer()':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/InfoServer.cpp:66: undefined reference to `InfoServerLoadMixer::InfoServerLoadMixer()'
../../../bin/Server/InfoServer/InfoServer.o: In function `SnmpMonitorServer<InfoSvrGeneralConfControl, _Mon_Info_Server_Info>::Release()':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:88: undefined reference to `shm_server_unregister'
../../../bin/Server/InfoServer/InfoServer.o: In function `__tcf_7':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/InfoServer.cpp:66: undefined reference to `InfoServerLoadMixer::~InfoServerLoadMixer()'
../../../bin/Server/InfoServer/InfoServer.o: In function `SnmpMonitorServer<InfoSvrGeneralConfControl, _Mon_Info_Server_Info>::OnTimer(CRtTimerWrapper*)':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:106: undefined reference to `shm_lock'
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:114: undefined reference to `shm_unlock'
../../../bin/Server/InfoServer/InfoServer.o: In function `SnmpMonitorServer<InfoSvrGeneralConfControl, _Mon_Info_Server_Info>::Release()':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:88: undefined reference to `shm_server_unregister'
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:88: undefined reference to `shm_server_unregister'
../../../bin/Server/InfoServer/InfoServer.o: In function `SnmpMonitorServer<InfoSvrGeneralConfControl, _Mon_Info_Server_Info>::Initialize(InfoSvrGeneralConfControl*, CRtString const&, CRtString const&, CRtString const&)':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/../../../src/util/h/SnmpMonitorServer.h:53: undefined reference to `shm_server_register'
../../../bin/libgcc.a(InfoSvrGeneralConfControl.o): In function `InfoSvrGeneralConfControl::OnNewConnection(CRtMessageBlock*, IConnection*)':
/root/project-space/box-infoserver-trunk-20111116/src/Server/InfoSvr4.2/gcc/InfoSvrGeneralConfControl.cpp:210: undefined reference to `CInfoSvrSlaveServerJoinConfRqstPdu::CInfoSvrSlaveServerJoinConfRqstPdu()'
/


# make -f Makefile.qa.infoserver

make -C util/dblog all -f Makefile
make[2]: Entering directory `/root/project-space/box-infoserver-trunk-20111116/src/util/dblog'
mkdir: 无法创建目录 “../../../bin/util/dblog”: 只读文件系统
make[2]: *** [../../../bin/util/dblog] 错误 1

[root@localhost /]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext3 ro,data=ordered 0 0
/dev /dev tmpfs rw 0 0
/proc /proc proc rw 0 0



5. 杂问

Q:USER_LINK_LIBS哪里定义?系统定义还是自定义?



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值