summaryrefslogblamecommitdiff
path: root/kaldi_seq/Makefile
blob: 9ac16254bb917c7d83b06027f956c4d6195c19ce (plain) (tree)







































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
# Change KDIR to `kaldi-trunk' path (Kaldi must be compiled with --share)
KDIR := /slfs6/users/ymz09/kaldi/

SHELL := /bin/bash
BUILD_DIR := $(CURDIR)/build
INC_PATH := $(LUA_BINDIR)/../include/
OBJS := init.o src/kaldi_mpe.o src/init.o
LIBS := libkaldiseq.so
INCLUDE := -I $(LUA_INCDIR) -I $(INC_PATH) -DLUA_USE_APICHECK

SUBDIR := src
OBJ_DIR := $(BUILD_DIR)/objs
LUA_DIR := $(INST_LUADIR)/kaldi_seq
KALDIINCLUDE := -I $(KDIR)/tools/ATLAS/include/ -I $(KDIR)/tools/openfst/include/ -I $(KDIR)/src/

OBJS := $(addprefix $(OBJ_DIR)/,$(OBJS))
LIBS := $(addprefix $(INST_LIBDIR)/,$(LIBS))
OBJ_SUBDIR := $(addprefix $(OBJ_DIR)/,$(SUBDIR))
LUA_SUBDIR := $(addprefix $(LUA_DIR)/,$(SUBDIR))
LIB_PATH := $(LUA_BINDIR)/../lib

build: $(OBJ_DIR) $(OBJ_SUBDIR) $(OBJS)
install: $(LUA_DIR) $(LUA_SUBDIR) $(LIBS)

include $(KDIR)/src/kaldi.mk
KL := -L/home/slhome/ymz09/mylibs/ -L$(KDIR)/tools/openfst-1.3.4/lib/ $(KDIR)/src/feat/kaldi-feat.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 $(KDIR)/src/cudamatrix/kaldi-cudamatrix.a $(KDIR)/src/lat/kaldi-lat.a $(KDIR)/src/hmm/kaldi-hmm.a $(KDIR)/src/tree/kaldi-tree.a $(KDIR)/src/matrix/kaldi-matrix.a $(KDIR)/src/util/kaldi-util.a $(KDIR)/src/base/kaldi-base.a -lcblas -llapack_atlas -lfst -lcudart -lcublas -DHAVE_CUDA

$(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR):
	-mkdir -p $@
$(LUA_DIR)/%.lua: %.lua
	cp $< $@
$(LIBS): $(OBJ_DIR)/src/kaldi_mpe.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o
	gcc -shared -fPIC -o $@ $(OBJ_DIR)/src/kaldi_mpe.o $(OBJ_DIR)/init.o $(OBJ_DIR)/src/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -lluaT $(KL)
$(OBJ_DIR)/src/kaldi_mpe.o: src/kaldi_mpe.cpp
	g++ -o $@ -c $< -DHAVE_ATLAS $(KALDIINCLUDE) -g -fPIC $(INCLUDE) -DKALDI_DOUBLEPRECISION=0 -msse2 -DHAVE_POSIX_MEMALIGN
$(OBJ_DIR)/%.o: %.c
	gcc -o $@ -c $< -g $(INCLUDE) -fPIC
clean:
	-rm $(OBJ_DIR)/src/*.o