DeepSpeech/native_client/Makefile
Reuben Morais ea7475d09c Ugly, very ugly, incredibly ugly static linking of libsox on macOS
All of the brew installed dependencies have static libraries as well, but the macOS linker will always prefer a dynamic library if both exist under the same `-L/foo -lbar` resolution. The only way to force static linking is to include a full path to the static library. These changes basically reverse engineer the static library locations and then pass those to the linker.
2020-04-28 14:13:53 +02:00

47 lines
1.5 KiB
Makefile

###
### From topdir, first use multistrap to prepare a raspbian buster armhf root
### $ multistrap -d multistrap-raspbian-buster -f native_client/multistrap_raspbian_buster.conf
###
### You can make a tarball after:
### $ touch multistrap-raspbian-buster.tar && sudo tar cf multistrap-raspbian-buster.tar multistrap-raspbian-buster/ && xz multistrap-raspbian-buster.tar
###
### Then cross-build:
### $ make -C native_client/ TARGET=rpi3 TFDIR=../../tensorflow/tensorflow/
###
.PHONY: clean run print-toolchain
include definitions.mk
default: $(DEEPSPEECH_BIN)
clean:
rm -f deepspeech
$(DEEPSPEECH_BIN): client.cc Makefile
$(CXX) $(CFLAGS) $(CFLAGS_DEEPSPEECH) $(SOX_CFLAGS) client.cc $(LDFLAGS) $(SOX_LDFLAGS)
ifeq ($(OS),Darwin)
install_name_tool -change bazel-out/local-opt/bin/native_client/libdeepspeech.so @rpath/libdeepspeech.so deepspeech
endif
run: $(DEEPSPEECH_BIN)
${META_LD_LIBRARY_PATH}=${TFDIR}/bazel-bin/native_client:${${META_LD_LIBRARY_PATH}} ./deepspeech ${ARGS}
debug: $(DEEPSPEECH_BIN)
${META_LD_LIBRARY_PATH}=${TFDIR}/bazel-bin/native_client:${${META_LD_LIBRARY_PATH}} gdb --args ./deepspeech ${ARGS}
install: $(DEEPSPEECH_BIN)
install -d ${PREFIX}/lib
install -m 0644 ${TFDIR}/bazel-bin/native_client/libdeepspeech.so ${PREFIX}/lib/
install -d ${PREFIX}/bin
install -m 0755 deepspeech ${PREFIX}/bin/
uninstall:
rm -f ${PREFIX}/bin/deepspeech
rmdir --ignore-fail-on-non-empty ${PREFIX}/bin
rm -f ${PREFIX}/lib/libdeepspeech.so
rmdir --ignore-fail-on-non-empty ${PREFIX}/lib
print-toolchain:
@echo $(TOOLCHAIN)