{"id":1018,"date":"2014-06-30T10:48:33","date_gmt":"2014-06-30T10:48:33","guid":{"rendered":"http:\/\/blog.zhukunqian.com\/?p=1018"},"modified":"2014-06-30T10:48:33","modified_gmt":"2014-06-30T10:48:33","slug":"%e5%a5%bd%e5%90%a7%ef%bc%8c%e4%b8%80%e4%b8%aamakefile%e7%9a%84%e5%88%9d%e5%ad%a6%e8%80%85%e5%ad%a6%e4%b9%a0skynet%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/blog.zhukunqian.com\/?p=1018","title":{"rendered":"\u597d\u5427\uff0c\u4e00\u4e2amakefile\u7684\u521d\u5b66\u8005\u5b66\u4e60skynet\u4e2d"},"content":{"rendered":"<p>1\u3001\u7b2c\u4e00\u6b65\u5c31\u662f\u9879\u76ee\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002skynet\u7ecf\u5e38\u8981\u66f4\u65b0\uff0c\u6240\u4ee5\u8981\u5c3d\u91cf\u907f\u514d\u5728\u81ea\u5df1\u9879\u76ee\u5171\u7528\u540c\u4e00\u4e2agit\u3002\u4ece\u7fa4\u4e2d\u548c\u4e91\u98ce\u7684\u6587\u7ae0\u4e2d\u4e86\u89e3\u5230\uff0c\u4f7f\u7528submodule\u5f15\u7528skynet\u662f\u4e00\u79cd\u6bd4\u8f83\u7406\u60f3\u7684\u65b9\u5f0f\u3002\u6211\u4e00\u4e2amakefile\u57fa\u672c\u4e3a0\u7684\u4eba\u8981\u7406\u89e3submodule\u7684\u7f16\u5199\u5f88\u4e0d\u5bb9\u6613\uff0c\u800c\u4e14\u4e5f\u4e0d\u77e5\u9053\u8fc7\u7a0b\u5bf9\u4e0d\u5bf9\uff0c\u4f46\u73b0\u5728\u81f3\u5c11\u5df2\u7ecf\u53ef\u4ee5\u521d\u6b65\u8fbe\u5230\u76ee\u6807\u4e86\u3002<\/p>\n<pre class=\"brush: shell; gutter: true\"># hello game\r\n#\r\n\r\n.PHONY : all clean skynet\r\n\r\nCC ?= gcc\r\nPLAT ?=linux\r\n\r\nLUA_CLIB_PATH=\/opt\/git\/hellogame\/luaclib\r\nCSERVICE_PATH=\/opt\/git\/hellogame\/cservice\r\n\r\nSKYNET_BUILD_PATH ?=\/opt\/git\/hellogame\r\n\r\nall : skynet\r\n\r\nskynet :\r\n        cd module_skynet &amp;&amp; $(MAKE) CC=$(CC) SKYNET_BUILD_PATH=$(SKYNET_BUILD_PATH) LUA_CLIB_PATH=$(LUA_CLIB_PATH) CSERVICE_PATH=$(CSERVICE_PATH) linux\r\n\r\nclean :\r\n        cd module_skynet &amp;&amp; $(MAKE) CC=$(CC) SKYNET_BUILD_PATH=$(SKYNET_BUILD_PATH) LUA_CLIB_PATH=$(LUA_CLIB_PATH) CSERVICE_PATH=$(CSERVICE_PATH) clean<\/pre>\n<p>\u5199\u7684\u5f88\u5dee\uff0c\u5148\u7528\u7740\u5427\u3002module_skynet\u662f\u5f15\u7528\u7684skynet<\/p>\n<p>2\u3001\u590d\u5236module_skynet\/example\/config\u5230\u672c\u5730\u76ee\u5f55\u3002<\/p>\n<p>\u7136\u540e\u4fee\u6539config\u4e2d\u7684lua\u5730\u5740:<\/p>\n<pre class=\"brush: bash; gutter: true\">root = &quot;.\/&quot;\r\nthread = 8\r\nlogger = nil\r\nharbor = 1\r\naddress = &quot;127.0.0.1:2526&quot;\r\nmaster = &quot;127.0.0.1:2013&quot;\r\nstart = &quot;main&quot;  -- main script\r\nbootstrap = &quot;snlua bootstrap&quot;   -- The service for bootstrap\r\nstandalone = &quot;0.0.0.0:2013&quot;\r\nluaservice = root..&quot;service\/?.lua;&quot;..root..&quot;test\/?.lua;&quot;..root..&quot;examples\/?.lua;&quot;..&quot;module_skynet\/service\/?.lua;&quot;..root..&quot;module_skynet\/test\/?.lua;&quot;..root..&quot;module_skynet\/examples\/?.lua&quot;\r\nlualoader = &quot;lualib\/loader.lua&quot;\r\n-- preload = &quot;.\/examples\/preload.lua&quot;   -- run preload.lua before every lua service run\r\nsnax = root..&quot;examples\/?.lua;&quot;..root..&quot;test\/?.lua&quot;\r\ncpath = root..&quot;cservice\/?.so&quot;\r\n-- daemon = &quot;.\/skynet.pid&quot;<\/pre>\n<p>\u53ea\u4fee\u6539\u5176\u4e2d luaservice\u7684\u5730\u5740\u3002<\/p>\n<p>3\u3001\u542f\u52a8 .\/skynet config\uff0c\u63d0\u793a\u627e\u4e0d\u5230lualib\/loader.lua\uff0c\u53c8\u5efa\u7acb\u4e86\u4e00\u4e2a\u8f6f\u8fde\u63a5\u6307\u5411module_skynet\/lualib\uff0c\u53ef\u4ee5\u987a\u5229\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n<p>4\u3001\u4ee5\u4e0a\u65b9\u5f0f\u4e0d\u4fdd\u8bc1\u662f\u6700\u5408\u9002\u7684\uff0c\u4f46\u81f3\u5c11\u53ef\u4ee5\u8fdb\u884c\u5f00\u53d1\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u7b2c\u4e00\u6b65\u5c31\u662f\u9879\u76ee\u7684\u7ec4\u7ec7\u65b9\u5f0f\u3002skynet\u7ecf\u5e38\u8981\u66f4\u65b0\uff0c\u6240\u4ee5\u8981\u5c3d\u91cf\u907f\u514d\u5728\u81ea\u5df1\u9879\u76ee\u5171 &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/blog.zhukunqian.com\/?p=1018\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1018"}],"collection":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1018"}],"version-history":[{"count":1,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1018\/revisions"}],"predecessor-version":[{"id":1020,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1018\/revisions\/1020"}],"wp:attachment":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}