Blame view

src/gst-plugin/Makefile 2.18 KB
8dcb6dfcb   Yannick Estève   first commit
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
  all:
  
  include ../kaldi.mk
  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 += -lgstbase-1.0 -lgstcontroller-1.0 -lgmodule-2.0 -lgthread-2.0
  EXTRA_LDLIBS += $(shell pkg-config --libs gstreamer-1.0)
  EXTRA_LDLIBS += $(shell pkg-config --libs glib-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 
  
  
  OBJFILES = gst-audio-source.o gst-online-gmm-decode-faster.o
  
  LIBNAME=gstonlinegmmdecodefaster
  
  LIBFILE = lib$(LIBNAME).so
  BINFILES= $(LIBFILE)
  
  all: $(LIBFILE)
  
  EXTRA_LDLIBS += ../../tools/portaudio/install/lib/libportaudio.a
  ifneq ($(wildcard ../../tools/portaudio/install/include/pa_linux_alsa.h),)
      EXTRA_LDLIBS += -lasound
  endif
  
  # Library so name and rpath
  CXX_VERSION=$(shell $(CXX) --version 2>/dev/null)
  ifneq (,$(findstring clang, $(CXX_VERSION)))
      # clang++ linker
      EXTRA_LDLIBS +=  -Wl,-install_name,$(LIBFILE) -Wl,-rpath,$(KALDILIBDIR)
  else
      # g++ linker
      EXTRA_LDLIBS +=  -Wl,-soname=$(LIBFILE) -Wl,--no-as-needed -Wl,-rpath=$(KALDILIBDIR) -lrt -pthread
  endif
  
  $(LIBFILE): $(OBJFILES)
  	$(CXX) -shared -DPIC -o $(LIBFILE) -L$(KALDILIBDIR) $(EXTRA_LDLIBS) $(LDLIBS) $(LDFLAGS) \
  	  $(OBJFILES)
   
  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