Skip to content

Commit

Permalink
add prefix skynet to c module
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Jun 1, 2017
1 parent f1ed482 commit f9f009a
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 69 deletions.
70 changes: 19 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,25 @@ update3rd :

CSERVICE = snlua logger gate harbor
LUA_CLIB = skynet \
skynet.socketdriver \
skynet.mongo \
skynet.netpack \
skynet.mysqlaux \
skynet.debugchannel \
skynet.profile \
skynet.cluster \
skynet.sharedata \
skynet.multicast \
skynet.memory \
skynet.crypt \
skynet.stm \
skynet.clientsocket \
clientsocket \
bson md5 sproto lpeg

LUA_CLIB_SKYNET = \
lua-skynet.c lua-seri.c \
lua-socket.c \
lua-mongo.c \
lua-netpack.c \
lua-memory.c \
lua-profile.c \
lua-multicast.c \
lua-cluster.c \
lua-crypt.c lsha1.c \
lua-sharedata.c \
lua-stm.c \
lua-mysqlaux.c \
lua-debugchannel.c \
\

SKYNET_SRC = skynet_main.c skynet_handle.c skynet_module.c skynet_mq.c \
skynet_server.c skynet_start.c skynet_timer.c skynet_error.c \
skynet_harbor.c skynet_env.c skynet_monitor.c skynet_socket.c socket_server.c \
Expand All @@ -87,60 +91,24 @@ endef

$(foreach v, $(CSERVICE), $(eval $(call CSERVICE_TEMP,$(v))))

$(LUA_CLIB_PATH)/skynet.so : lualib-src/lua-skynet.c lualib-src/lua-seri.c | $(LUA_CLIB_PATH)
$(LUA_CLIB_PATH)/skynet.so : $(addprefix lualib-src/,$(LUA_CLIB_SKYNET)) | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@ -Iskynet-src -Iservice-src -Ilualib-src

$(LUA_CLIB_PATH)/skynet.socketdriver.so : lualib-src/lua-socket.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@ -Iskynet-src -Iservice-src

$(LUA_CLIB_PATH)/bson.so : lualib-src/lua-bson.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@ -Iskynet-src

$(LUA_CLIB_PATH)/skynet.mongo.so : lualib-src/lua-mongo.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@ -Iskynet-src

$(LUA_CLIB_PATH)/md5.so : 3rd/lua-md5/md5.c 3rd/lua-md5/md5lib.c 3rd/lua-md5/compat-5.2.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -I3rd/lua-md5 $^ -o $@

$(LUA_CLIB_PATH)/skynet.netpack.so : lualib-src/lua-netpack.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -Iskynet-src -o $@

$(LUA_CLIB_PATH)/skynet.clientsocket.so : lualib-src/lua-clientsocket.c | $(LUA_CLIB_PATH)
$(LUA_CLIB_PATH)/clientsocket.so : lualib-src/lua-clientsocket.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@ -lpthread

$(LUA_CLIB_PATH)/skynet.memory.so : lualib-src/lua-memory.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

$(LUA_CLIB_PATH)/skynet.profile.so : lualib-src/lua-profile.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@

$(LUA_CLIB_PATH)/skynet.multicast.so : lualib-src/lua-multicast.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

$(LUA_CLIB_PATH)/skynet.cluster.so : lualib-src/lua-cluster.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

$(LUA_CLIB_PATH)/skynet.crypt.so : lualib-src/lua-crypt.c lualib-src/lsha1.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@

$(LUA_CLIB_PATH)/skynet.sharedata.so : lualib-src/lua-sharedata.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

$(LUA_CLIB_PATH)/skynet.stm.so : lualib-src/lua-stm.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

$(LUA_CLIB_PATH)/sproto.so : lualib-src/sproto/sproto.c lualib-src/sproto/lsproto.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Ilualib-src/sproto $^ -o $@

$(LUA_CLIB_PATH)/lpeg.so : 3rd/lpeg/lpcap.c 3rd/lpeg/lpcode.c 3rd/lpeg/lpprint.c 3rd/lpeg/lptree.c 3rd/lpeg/lpvm.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -I3rd/lpeg $^ -o $@

$(LUA_CLIB_PATH)/skynet.mysqlaux.so : lualib-src/lua-mysqlaux.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) $^ -o $@

$(LUA_CLIB_PATH)/skynet.debugchannel.so : lualib-src/lua-debugchannel.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Iskynet-src $^ -o $@

clean :
rm -f $(SKYNET_BUILD_PATH)/skynet $(CSERVICE_PATH)/*.so $(LUA_CLIB_PATH)/*.so

Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ lconcat(lua_State *L) {
}

LUAMOD_API int
luaopen_cluster_core(lua_State *L) {
luaopen_skynet_cluster_core(lua_State *L) {
luaL_Reg l[] = {
{ "packrequest", lpackrequest },
{ "packpush", lpackpush },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ int lsha1(lua_State *L);
int lhmac_sha1(lua_State *L);

LUAMOD_API int
luaopen_crypt(lua_State *L) {
luaopen_skynet_crypt(lua_State *L) {
luaL_checkversion(L);
static int init = 0;
if (!init) {
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-debugchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ static int db_sethook (lua_State *L) {
}

LUAMOD_API int
luaopen_debugchannel(lua_State *L) {
luaopen_skynet_debugchannel(lua_State *L) {
luaL_Reg l[] = {
{ "create", lcreate }, // for write
{ "connect", lconnect }, // for read
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ lcurrent(lua_State *L) {
}

LUAMOD_API int
luaopen_memory(lua_State *L) {
luaopen_skynet_memory(lua_State *L) {
luaL_checkversion(L);

luaL_Reg l[] = {
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-mongo.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ reply_length(lua_State *L) {
}

LUAMOD_API int
luaopen_mongo_driver(lua_State *L) {
luaopen_skynet_mongo_driver(lua_State *L) {
luaL_checkversion(L);
luaL_Reg l[] ={
{ "query", op_query },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ mc_nextid(lua_State *L) {
}

LUAMOD_API int
luaopen_multicast_core(lua_State *L) {
luaopen_skynet_multicast_core(lua_State *L) {
luaL_Reg l[] = {
{ "pack", mc_packlocal },
{ "unpack", mc_unpacklocal },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-mysqlaux.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static struct luaL_Reg mysqlauxlib[] = {
};


LUAMOD_API int luaopen_mysqlaux_c (lua_State *L) {
LUAMOD_API int luaopen_skynet_mysqlaux_c (lua_State *L) {
lua_newtable(L);
luaL_setfuncs(L, mysqlauxlib, 0);
return 1;
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-netpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ ltostring(lua_State *L) {
}

LUAMOD_API int
luaopen_netpack(lua_State *L) {
luaopen_skynet_netpack(lua_State *L) {
luaL_checkversion(L);
luaL_Reg l[] = {
{ "pop", lpop },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ lyield_co(lua_State *L) {
}

LUAMOD_API int
luaopen_profile(lua_State *L) {
luaopen_skynet_profile(lua_State *L) {
luaL_checkversion(L);
luaL_Reg l[] = {
{ "start", lstart },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-sharedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ lupdate(lua_State *L) {
}

LUAMOD_API int
luaopen_sharedata_core(lua_State *L) {
luaopen_skynet_sharedata_core(lua_State *L) {
luaL_Reg l[] = {
// used by host
{ "new", lnewconf },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ ludp_address(lua_State *L) {
}

LUAMOD_API int
luaopen_socketdriver(lua_State *L) {
luaopen_skynet_socketdriver(lua_State *L) {
luaL_checkversion(L);
luaL_Reg l[] = {
{ "buffer", lnewbuffer },
Expand Down
2 changes: 1 addition & 1 deletion lualib-src/lua-stm.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ lread(lua_State *L) {
}

LUAMOD_API int
luaopen_stm(lua_State *L) {
luaopen_skynet_stm(lua_State *L) {
luaL_checkversion(L);
lua_createtable(L, 0, 3);

Expand Down
4 changes: 2 additions & 2 deletions lualib/snax/gateserver.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local skynet = require "skynet"
local netpack = require "netpack"
local socketdriver = require "socketdriver"
local netpack = require "skynet.netpack"
local socketdriver = require "skynet.socketdriver"

local gateserver = {}

Expand Down
2 changes: 1 addition & 1 deletion lualib/snax/loginserver.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local skynet = require "skynet"
require "skynet.manager"
local socket = require "skynet.socket"
local crypt = require "crypt"
local crypt = require "skynet.crypt"
local table = table
local string = string
local assert = assert
Expand Down
6 changes: 3 additions & 3 deletions lualib/snax/msgserver.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local skynet = require "skynet"
local gateserver = require "snax.gateserver"
local netpack = require "netpack"
local crypt = require "crypt"
local socketdriver = require "socketdriver"
local netpack = require "skynet.netpack"
local crypt = require "skynet.crypt"
local socketdriver = require "skynet.socketdriver"
local assert = assert
local b64encode = crypt.base64encode
local b64decode = crypt.base64decode
Expand Down

0 comments on commit f9f009a

Please sign in to comment.