Makefile 1.95 KB
Newer Older
1 2 3
all:

include ../kaldi.mk
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
ifneq ($(KALDI_FLAVOR), dynamic)
$(error Kaldi must compiled with dynamic libraries support. Run configure with --shared flag. )
endif

EXTRA_CXXFLAGS = -Wno-sign-compare -I ../../tools/portaudio/install/include 
EXTRA_CXXFLAGS += $(shell pkg-config --cflags gstreamer-1.0)
EXTRA_CXXFLAGS += $(shell pkg-config --cflags glib-2.0)

EXTRA_LDLIBS = -pthread -lgstbase-1.0 -lgstcontroller-1.0 -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0

#Kaldi shared libraries required by the GStreamer plugin
EXTRA_LDLIBS += -lkaldi-online -lkaldi-lat -lkaldi-decoder -lkaldi-feat -lkaldi-transform \
 -lkaldi-gmm -lkaldi-hmm \
 -lkaldi-tree -lkaldi-matrix  -lkaldi-util -lkaldi-base

19 20 21 22 23 24 25 26 27 28

OBJFILES = gst-audio-source.o gst-online-gmm-decode-faster.o

LIBNAME=gstkaldi

LIBFILE = lib$(LIBNAME).so
BINFILES= $(LIBFILE)

all: $(LIBFILE)

29 30 31 32 33 34
EXTRA_LDLIBS += ../../tools/portaudio/install/lib/libportaudio.a
ifneq ($(wildcard ../../tools/portaudio/install/include/pa_linux_alsa.h),)
    EXTRA_LDLIBS += -lasound
else
    EXTRA_LDLIBS += -lrt
endif
35

36
# MKL libs required when linked via shared library
37
ifdef MKLROOT
38
	EXTRA_LDLIBS+=-lmkl_p4n -lmkl_def
39 40 41
endif

$(LIBFILE): $(OBJFILES)
42 43 44
	$(CXX) -shared -DPIC -o $(LIBFILE) -Wl,-soname=$(LIBFILE) \
	  -L$(KALDILIBDIR) -Wl,-rpath=$(KALDILIBDIR) $(EXTRA_LDLIBS) $(LDLIBS) $(LDFLAGS) \
	  $(OBJFILES)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
 
kaldimarshal.h: kaldimarshal.list
	glib-genmarshal --header --prefix=kaldi_marshal kaldimarshal.list > kaldimarshal.h.tmp
	mv kaldimarshal.h.tmp kaldimarshal.h

kaldimarshal.cc: kaldimarshal.list
	echo "#include \"glib-object.h\"" >> kaldimarshal.c.tmp
	echo "#include \"kaldimarshal.h\"" >> kaldimarshal.c.tmp
	glib-genmarshal --body --prefix=kaldi_marshal kaldimarshal.list >> kaldimarshal.c.tmp
	mv kaldimarshal.c.tmp kaldimarshal.cc
 
clean: 
	-rm -f *.o *.a $(TESTFILES) $(BINFILES) kaldimarshal.h kaldimarshal.cc
 
depend: kaldimarshal.h kaldimarshal.cc
	-$(CXX) -M $(CXXFLAGS) *.cc > .depend.mk  

-include .depend.mk
63

64