diff options
author | Determinant <[email protected]> | 2015-06-22 18:56:04 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-06-22 18:56:04 +0800 |
commit | 32eac093cc431849a92e5a2297c5fe646fd60556 (patch) | |
tree | 28a7043f7d7138d58916b60de7231b093d93bbde /Makefile | |
parent | 3910eb670f3c29aba95596bb8c55cbee3368f805 (diff) |
make it a luarocks package
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 34 |
1 files changed, 27 insertions, 7 deletions
@@ -1,13 +1,33 @@ .PHONY: tnet -INCLUDE := -I $(BUILD_DIR)/luajit-2.0/include/luajit-2.0 -all: tnet $(OBJ_DIR)/tnet_io/test $(LIB_DIR)/libspeech.so $(LUA_DIR)/speech/init.lua -$(LUA_DIR)/speech/init.lua: init.lua - mkdir -p $(LUA_DIR)/speech +SHELL := /bin/bash +BUILD_DIR := $(CURDIR)/build +OBJS := init.o tnet_io/cwrapper.o tnet_io/init.o +LIBS := libspeech.so +LUA_LIBS := init.lua +INCLUDE := -I $(LUA_INCDIR) -DLUA_USE_APICHECK + +SUBDIR := tnet_io +OBJ_DIR := $(BUILD_DIR)/objs +LUA_DIR = $(INST_LUADIR)/speech + +OBJS := $(addprefix $(OBJ_DIR)/,$(OBJS)) +LIBS := $(addprefix $(INST_LIBDIR)/,$(LIBS)) +OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR)) +LUA_SUBDIR := $(addprefix $(LUA_DIR)/,$(SUBDIR)) +LUA_LIBS := $(addprefix $(LUA_DIR)/,$(LUA_LIBS)) +LIB_PATH := $(LUA_BINDIR)/../lib + +build: $(OBJ_DIR) $(OBJ_SUBDIR) $(OBJS) tnet $(OBJ_DIR)/tnet_io/test +install: $(LUA_DIR) $(LUA_SUBDIR) $(LUA_LIBS) $(LIBS) + +$(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR): + -mkdir -p $@ +$(LUA_DIR)/%.lua: %.lua cp $< $@ -$(LIB_DIR)/libspeech.so: $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a - gcc -shared -o $@ $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a $(OBJ_DIR)/tnet_io/init.o -lstdc++ -Wl,-rpath=$(LIB_DIR) -L$(LIB_DIR) -lnerv +$(LIBS): $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a + gcc -shared -o $@ $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a $(OBJ_DIR)/tnet_io/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnerv $(OBJ_DIR)/tnet_io/test: $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/tnet_io/test.o $(OBJ_DIR)/tnet_io/libKaldiLib.a - gcc -o $@ $^ -Wl,-rpath=$(LIB_DIR) -L$(LIB_DIR) -lnerv -Wl,-rpath=$(BUILD_DIR)/luajit-2.0/lib -L$(BUILD_DIR)/luajit-2.0/lib -lluajit-5.1 -lstdc++ -lm + gcc -o $@ $^ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnerv -Wl,-rpath=$(LUA_LIBDIR) -L$(LUA_LIBDIR) -lluajit-5.1 -lstdc++ -lm $(OBJ_DIR)/tnet_io/cwrapper.o: tnet_io/cwrapper.cpp g++ -o $@ -c $< -DHAVE_ATLAS -I tnet_io/KaldiLib/ -g -fPIC $(INCLUDE) $(OBJ_DIR)/%.o: %.c |