好吧,一个makefile的初学者学习skynet中

1、第一步就是项目的组织方式。skynet经常要更新,所以要尽量避免在自己项目共用同一个git。从群中和云风的文章中了解到,使用submodule引用skynet是一种比较理想的方式。我一个makefile基本为0的人要理解submodule的编写很不容易,而且也不知道过程对不对,但现在至少已经可以初步达到目标了。

# hello game
#

.PHONY : all clean skynet

CC ?= gcc
PLAT ?=linux

LUA_CLIB_PATH=/opt/git/hellogame/luaclib
CSERVICE_PATH=/opt/git/hellogame/cservice

SKYNET_BUILD_PATH ?=/opt/git/hellogame

all : skynet

skynet :
        cd module_skynet && $(MAKE) CC=$(CC) SKYNET_BUILD_PATH=$(SKYNET_BUILD_PATH) LUA_CLIB_PATH=$(LUA_CLIB_PATH) CSERVICE_PATH=$(CSERVICE_PATH) linux

clean :
        cd module_skynet && $(MAKE) CC=$(CC) SKYNET_BUILD_PATH=$(SKYNET_BUILD_PATH) LUA_CLIB_PATH=$(LUA_CLIB_PATH) CSERVICE_PATH=$(CSERVICE_PATH) clean

写的很差,先用着吧。module_skynet是引用的skynet

2、复制module_skynet/example/config到本地目录。

然后修改config中的lua地址:

root = "./"
thread = 8
logger = nil
harbor = 1
address = "127.0.0.1:2526"
master = "127.0.0.1:2013"
start = "main"  -- main script
bootstrap = "snlua bootstrap"   -- The service for bootstrap
standalone = "0.0.0.0:2013"
luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua;".."module_skynet/service/?.lua;"..root.."module_skynet/test/?.lua;"..root.."module_skynet/examples/?.lua"
lualoader = "lualib/loader.lua"
-- preload = "./examples/preload.lua"   -- run preload.lua before every lua service run
snax = root.."examples/?.lua;"..root.."test/?.lua"
cpath = root.."cservice/?.so"
-- daemon = "./skynet.pid"

只修改其中 luaservice的地址。

3、启动 ./skynet config,提示找不到lualib/loader.lua,又建立了一个软连接指向module_skynet/lualib,可以顺利解决问题。

4、以上方式不保证是最合适的,但至少可以进行开发了。

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /opt/wordpress/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048