index 17f122622f143107b43bfb86c24d4afb16bf97f9..510c9bca90590f1f083d239cf57b9a100b2b62ed 100644 (file)
ifeq ($(KALDI_FLAVOR), dynamic)
ifeq ($(shell uname), Darwin)
- XLDLIBS := $(LDLIBS)
ifdef LIBNAME
LIBFILE = lib$(LIBNAME).dylib
- #LDLIBS += -l$(LIBNAME)
endif
- LDFLAGS += -L$(KALDILIBDIR) -Wl,-rpath -Wl,$(KALDILIBDIR)
- XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).dylib )
- XLDLIBS += $(foreach dep,$(ADDLIBS), -l$(notdir $(basename $(dep))) )
- else
- ifeq ($(shell uname), Linux)
- ifdef LIBNAME
- LIBFILE = lib$(LIBNAME).so
- #LDLIBS += -l$(LIBNAME)
- endif
- LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR)) -L.
- LDFLAGS += $(foreach dep,$(ADDLIBS), -L$(dir $(dep)) )
- XDEPENDS = $(foreach dep,$(ADDLIBS), $(dir $(dep))/lib$(notdir $(basename $(dep))).so )
- else # Platform not supported
- $(error Dynamic libraries not supported on this platform. Run configure with --static flag. )
+ LDFLAGS += -Wl,-rpath -Wl,$(KALDILIBDIR)
+ EXTRA_LDLIBS += $(foreach dep,$(ADDLIBS), $(dir $(dep))lib$(notdir $(basename $(dep))).dylib)
+ else ifeq ($(shell uname), Linux)
+ ifdef LIBNAME
+ LIBFILE = lib$(LIBNAME).so
endif
+ LDFLAGS += -Wl,-rpath=$(shell readlink -f $(KALDILIBDIR))
+ EXTRA_LDLIBS += $(foreach dep,$(ADDLIBS), $(dir $(dep))lib$(notdir $(basename $(dep))).so)
+ else # Platform not supported
+ $(error Dynamic libraries not supported on this platform. Run configure with --static flag.)
endif
- LDLIBS += $(foreach dep,$(ADDLIBS), -l$(notdir $(basename $(dep))) )
+ XDEPENDS =
else
ifdef LIBNAME
LIBFILE = $(LIBNAME).a
$(AR) -cru $(LIBNAME).a $(OBJFILES)
$(RANLIB) $(LIBNAME).a
ifeq ($(KALDI_FLAVOR), dynamic)
-ifeq ($(shell uname), Darwin)
- $(CXX) -dynamiclib -o $@ -install_name @rpath/$@ -framework Accelerate $(LDFLAGS) $(XLDLIBS) $(OBJFILES) $(LDLIBS)
+ ifeq ($(shell uname), Darwin)
+ $(CXX) -dynamiclib -o $@ -install_name @rpath/$@ $(LDFLAGS) $(OBJFILES) $(LDLIBS)
rm -f $(KALDILIBDIR)/$@; ln -s $(shell pwd)/$@ $(KALDILIBDIR)/$@
-else
-ifeq ($(shell uname), Linux)
- # Building shared library from static (static was compiled with -fPIC)
- $(CXX) -shared -o $@ -Wl,--no-undefined -Wl,--as-needed -Wl,-soname=$@,--whole-archive $(LIBNAME).a -Wl,--no-whole-archive $(LDFLAGS) $(XDEPENDS) $(LDLIBS)
+ else ifeq ($(shell uname), Linux)
+ # Building shared library from static (static was compiled with -fPIC)
+ $(CXX) -shared -o $@ -Wl,--no-undefined -Wl,--as-needed -Wl,-soname=$@,--whole-archive $(LIBNAME).a -Wl,--no-whole-archive $(LDFLAGS) $(LDLIBS)
rm -f $(KALDILIBDIR)/$@; ln -s $(shell pwd)/$@ $(KALDILIBDIR)/$@
- #cp $@ $(KALDILIBDIR)
-else # Platform not supported
- $(error Dynamic libraries not supported on this platform. Run configure with --static flag. )
-endif
-endif
+ else # Platform not supported
+ $(error Dynamic libraries not supported on this platform. Run configure with --static flag.)
+ endif
endif
+# By default (GNU) make uses the C compiler $(CC) for linking object files even
+# if they were compiled from a C++ source. Below redefinition forces make to
+# use the C++ compiler $(CXX) instead.
+LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
$(BINFILES): $(LIBFILE) $(XDEPENDS)
+# When building under CI, CI_NOLINKBINARIES is set to skip linking of binaries.
+ifdef CI_NOLINKBINARIES
+$(BINFILES): %: %.o
+ touch $@
+endif
# Rule below would expand to, e.g.:
# ../base/kaldi-base.a:
-# make -c ../base kaldi-base.a
-# -c option to make is same as changing directory.
+# make -C ../base kaldi-base.a
+# -C option to make is same as changing directory.
%.a:
$(MAKE) -C ${@D} ${@F}
rm -rf core; \
fi; \
else \
- echo " $${time_taken}s... SUCCESS"; \
+ echo " $${time_taken}s... SUCCESS $$x"; \
rm -f $$x.testlog; \
fi; \
done; \
exit $$result; }
-.valgrind: $(BINFILES) $(TESTFILES)
+# Rules that enable valgrind debugging ("make valgrind")
+
+valgrind: .valgrind
+.valgrind: $(TESTFILES)
+ echo -n > valgrind.out
+ for x in $(TESTFILES); do \
+ echo $$x >>valgrind.out; \
+ valgrind ./$$x >/dev/null 2>> valgrind.out; \
+ done
+ ! ( grep 'ERROR SUMMARY' valgrind.out | grep -v '0 errors' )
+ ! ( grep 'definitely lost' valgrind.out | grep -v -w 0 )
+ rm valgrind.out
+ touch .valgrind
depend:
-$(CXX) -M $(CXXFLAGS) *.cc > .depend.mk