forked from UFAL-DSG/alex-asr
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
87 lines (72 loc) · 2.64 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
LIBNAME = alex_asr
KALDI_DIR = libs/kaldi
PYFST_DIR = libs/pyfst
CC = g++
CXX = g++
AR = ar
AS = as
RANLIB = ranlib
PYTHON = python3
# PYTHON = python3 # Use this line if you want to build the extension for python3.
FSTROOT = $(KALDI_DIR)/tools/openfst/
LIBFILE = $(LIBNAME).a
OBJFILES = src/decoder.o src/utils.o src/feature_pipeline.o \
src/decoder_config.o src/decoder_cli.o
BINFILES = src/decoder_cli
CXXFLAGS = -std=gnu++11 -msse -msse2 -Wall \
-pthread \
-DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN \
-Wno-sign-compare -Wno-unused-local-typedefs -Winit-self \
-DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H \
-DHAVE_ATLAS \
-g \
-I$(FSTROOT)/include \
-I$(KALDI_DIR)/src \
-I$(KALDI_DIR)/tools/OpenBLAS/install/include \
-Wno-sign-compare -I. -fPIC
ADDLIBS = $(FSTROOT)/src/lib/.libs/libfst.a \
$(KALDI_DIR)/src/online2/kaldi-online2.a \
$(KALDI_DIR)/src/ivector/kaldi-ivector.a \
$(KALDI_DIR)/src/nnet2/kaldi-nnet2.a \
$(KALDI_DIR)/src/nnet3/kaldi-nnet3.a \
$(KALDI_DIR)/src/lat/kaldi-lat.a \
$(KALDI_DIR)/src/lm/kaldi-lm.a \
$(KALDI_DIR)/src/decoder/kaldi-decoder.a \
$(KALDI_DIR)/src/cudamatrix/kaldi-cudamatrix.a \
$(KALDI_DIR)/src/feat/kaldi-feat.a \
$(KALDI_DIR)/src/transform/kaldi-transform.a \
$(KALDI_DIR)/src/gmm/kaldi-gmm.a \
$(KALDI_DIR)/src/hmm/kaldi-hmm.a \
$(KALDI_DIR)/src/tree/kaldi-tree.a \
$(KALDI_DIR)/src/matrix/kaldi-matrix.a \
$(KALDI_DIR)/src/util/kaldi-util.a \
$(KALDI_DIR)/src/base/kaldi-base.a \
$(KALDI_DIR)/src/fstext/kaldi-fstext.a \
$(KALDI_DIR)/tools/OpenBLAS/install/lib/libopenblas.a
LDFLAGS = $(ADDLIBS) -lgfortran -lm -lpthread -ldl
all: $(LIBFILE) $(BINFILES) py_flags
$(LIBFILE): $(OBJFILES)
$(AR) -cru $(LIBNAME).a $(OBJFILES)
$(RANLIB) $(LIBNAME).a
$(BINFILES): $(OBJFILES)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: py_flags
py_flags:
echo $(LIBNAME).a $(ADDLIBS) > setup.py.add_libs
echo $(CXXFLAGS) > setup.py.cxxflags_kaldi
echo "-L$(FSTROOT)/lib -L$(FSTROOT)/lib/fst" > setup.py.cxxflags_pyfst
clean:
rm -rf build
rm -f $(LIBFILE)
rm -f $(OBJFILES) $(BINFILES)
test:
(PYTHONPATH=$(shell echo build/lib.*) python test/test.py )
docker_build:
docker build -t choko/alex-asr .
docker_test:
docker run -i -t --rm \
-v `pwd`/test:/opt/app/alex-asr/test \
-v `pwd`/Makefile:/opt/app/alex-asr/Makefile \
-v `pwd`/src:/opt/app/alex-asr/src \
choko/alex-asr \
bash -c "make -j 4 && python setup.py install && cd test && python test.py"