summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2009-12-26 18:55:40 +0000
committerChristian Pointner <equinox@anylike.org>2009-12-26 18:55:40 +0000
commitf6340e311b8ec6691aed77574b842d338cd9c122 (patch)
treeb1ead092cd3a32ae0e01cef3e41b5e48dc80e03c
parentfixed some typos at output (diff)
use single lua object file now
-rw-r--r--src/Makefile16
-rw-r--r--src/anylike.c14
2 files changed, 15 insertions, 15 deletions
diff --git a/src/Makefile b/src/Makefile
index b450a8e..7b86972 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,6 +28,7 @@ include include.mk
endif
EXECUTABLE := anylike
+LUA_OBJ := $(EXECUTABLE).lc
# sig_handler.o \
# sysexec.o \
@@ -39,15 +40,13 @@ C_OBJS := log.o \
l_crypt.o \
anylike.o
-LUA_OBJS := main_loop.lc
+C_SRCS := $(C_OBJS:%.o=%.c)
-
-C_SRC := $(C_OBJS:%.o=%.c)
-LUA_SRC := &(LUA_OBJS:%.lc=%lua)
+LUA_SRCS := main_loop.lua
.PHONY: clean cleanall distclean manpage install install-bin install-etc install-man uninstall remove purge
-all: $(EXECUTABLE) $(LUA_OBJS)
+all: $(EXECUTABLE) $(LUA_OBJ)
%.d: %.c
@set -e; rm -f $@; \
@@ -56,7 +55,7 @@ all: $(EXECUTABLE) $(LUA_OBJS)
rm -f $@.$$$$; echo '(re)building $@'
ifneq ($(MAKECMDGOALS),distclean)
--include $(C_SRC:%.c=%.d)
+-include $(C_SRCS:%.c=%.d)
endif
$(EXECUTABLE): $(C_OBJS)
@@ -65,11 +64,12 @@ $(EXECUTABLE): $(C_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
-%.lc: %.lua
+$(LUA_OBJ): $(LUA_SRCS)
$(LUAC) -o $@ $<
-strip: $(EXECUTABLE)
+strip: $(EXECUTABLE) $(LUA_OBJ)
$(STRIP) -s $(EXECUTABLE)
+ $(LUAC) -s -o $(LUA_OBJ) $(LUA_OBJ)
distclean: cleanall
find . -name *.o -exec rm -f {} \;
diff --git a/src/anylike.c b/src/anylike.c
index 93990a0..504f10f 100644
--- a/src/anylike.c
+++ b/src/anylike.c
@@ -74,7 +74,7 @@ int init_libgcrypt()
#endif
-#define LUA_MAIN_LOOP_FILE "main_loop.lc"
+#define LUA_OBJ_FILE "anylike.lc"
#define LUA_MAIN_LOOP_FUNC "main_loop"
static const luaL_Reg anylike_lualibs[] = {
@@ -97,14 +97,14 @@ int init_main_loop(lua_State *L)
lua_call(L, 1, 0);
}
- int ret = luaL_loadfile(L, LUA_MAIN_LOOP_FILE);
+ int ret = luaL_loadfile(L, LUA_OBJ_FILE);
if(ret) {
const char* err_str = luaL_checkstring(L, -1);
switch(ret) {
- case LUA_ERRSYNTAX: log_printf(ERROR, "luaL_loadfile(%s) syntax error: %s", LUA_MAIN_LOOP_FILE, err_str); break;
- case LUA_ERRMEM: log_printf(ERROR, "luaL_loadfile(%s) malloc error: %s", LUA_MAIN_LOOP_FILE, err_str); break;
- case LUA_ERRFILE: log_printf(ERROR, "luaL_loadfile(%s) file access error: %s", LUA_MAIN_LOOP_FILE, err_str); break;
- default: log_printf(ERROR, "luaL_loadfile(%s) unknown error: %s", LUA_MAIN_LOOP_FILE, err_str); break;
+ case LUA_ERRSYNTAX: log_printf(ERROR, "luaL_loadfile(%s) syntax error: %s", LUA_OBJ_FILE, err_str); break;
+ case LUA_ERRMEM: log_printf(ERROR, "luaL_loadfile(%s) malloc error: %s", LUA_OBJ_FILE, err_str); break;
+ case LUA_ERRFILE: log_printf(ERROR, "luaL_loadfile(%s) file access error: %s", LUA_OBJ_FILE, err_str); break;
+ default: log_printf(ERROR, "luaL_loadfile(%s) unknown error: %s", LUA_OBJ_FILE, err_str); break;
}
return -1;
}
@@ -127,7 +127,7 @@ int call_main_loop(lua_State* L, options_t* opt)
{
lua_getglobal(L, LUA_MAIN_LOOP_FUNC);
if(!lua_isfunction(L, -1)) {
- log_printf(ERROR, "there is no function '%s' in '%s'", LUA_MAIN_LOOP_FUNC, LUA_MAIN_LOOP_FILE);
+ log_printf(ERROR, "there is no function '%s' in '%s'", LUA_MAIN_LOOP_FUNC, LUA_OBJ_FILE);
return -1;
};