diff options
author | Determinant <[email protected]> | 2016-02-29 20:03:52 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2016-02-29 20:03:52 +0800 |
commit | 1e0ac0fb5c9f517e7325deb16004de1054454da7 (patch) | |
tree | c75a6f0fc9aa50caa9fb9dccec7a56b41d3b63fd /kaldi_decode/Makefile | |
parent | fda1c8cf07c5130aff53775454a5f2cfc8f5d2e0 (diff) |
refactor kaldi_decode
Diffstat (limited to 'kaldi_decode/Makefile')
-rw-r--r-- | kaldi_decode/Makefile | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/kaldi_decode/Makefile b/kaldi_decode/Makefile new file mode 100644 index 0000000..e3a7c2d --- /dev/null +++ b/kaldi_decode/Makefile @@ -0,0 +1,43 @@ +ifndef LUA_BINDIR +$(error Please build the package via luarocks: `luarocks make`) +endif + +ifndef KALDI_BASE +$(error KALDI_BASE is not set) +endif + +ifndef CUDA_BASE +$(error CUDA_BASE is not set) +endif + +KDIR := $(KALDI_BASE) +BUILD_DIR := $(CURDIR)/build +INC_PATH := $(LUA_BINDIR)/../include/ +OBJS := src/nnet-forward.o nnet-forward + +SUBDIR := src +OBJ_DIR := $(BUILD_DIR)/objs +LUA_DIR = $(INST_LUADIR)/kaldi_decode +KALDIINCLUDE := -I $(KDIR)/tools/ATLAS/include/ -I $(KDIR)/tools/openfst/include/ -I $(KDIR)/src/ + +OBJS := $(addprefix $(OBJ_DIR)/,$(OBJS)) +OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR)) + +KL := $(KDIR)/src/feat/kaldi-feat.a $(KDIR)/src/cudamatrix/kaldi-cudamatrix.a $(KDIR)/src/matrix/kaldi-matrix.a $(KDIR)/src/base/kaldi-base.a $(KDIR)/src/util/kaldi-util.a $(KDIR)/src/hmm/kaldi-hmm.a $(KDIR)/src/tree/kaldi-tree.a $(KDIR)/src/nnet/kaldi-nnet.a $(BLAS_LDFLAGS) + +build: $(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(OBJS) +$(OBJ_DIR)/%.o: %.cc + g++ -c -o $@ $< -Wall $(KALDIINCLUDE) -DHAVE_ATLAS -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -DLUA_USE_APICHECK -I $(LUA_INCDIR) -I $(INC_PATH) $(CFLAGS) +$(OBJ_DIR)/nnet-forward: $(OBJ_DIR)/src/nnet-forward.o + g++ -o $@ $< $(KL) -L$(LUA_LIBDIR) -Wl,-rpath=$(LUA_LIBDIR) -lluajit-5.1 -L$(CUDA_BASE)/lib64/ -Wl,-rpath=$(CUDA_BASE)/lib64/ -lcudart -lcublas -ldl +$(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR): + -mkdir -p $@ +install: $(LUA_DIR) + cp $(OBJ_DIR)/nnet-forward $(LUA_BINDIR)/nnet-forward-with-nerv + cp src/asr_propagator.lua $(LUA_DIR)/ + sed 's*nnet_forward=*nnet_forward=$(LUA_BINDIR)/nnet-forward-with-nerv.sh*g;s*asr_propagator=*asr_propagator=$(LUA_BINDIR)/../share/lua/5.1/kaldi_decode/asr_propagator.lua*g' decode_with_nerv.sh > $(LUA_BINDIR)/decode_with_nerv.sh + echo '$(LUA_BINDIR)/nnet-forward-with-nerv "$$@"' | cat nnet-forward-with-nerv.sh - | sed 's*\.\./\.\./install/bin/luarocks*$(LUA_BINDIR)/luarocks*g' > $(LUA_BINDIR)/nnet-forward-with-nerv.sh + chmod +x $(LUA_BINDIR)/nnet-forward-with-nerv.sh + chmod +x $(LUA_BINDIR)/decode_with_nerv.sh +clean: + -rm -r $(OBJ_DIR) |