# This Makefile is an example of how to link a program with the Mod9
# ASR C++ Library. It should work with both shared (.so) and static (.a)
# versions of the Library. It creates a program "mod9-asr-example"
# that exercises the Mod9 ASR C++ Library in various ways.
#
# The example uses nlohmann_json and the pthread library, but neither
# are strictly required to use the Mod9 ASR C++ Library.
#

# Directory of the nlohmann_json json.hpp header file.
NLOHMANN_DIR=..

# Directory containing the Mod9 ASR C++ Library header file.
MOD9_ASR_INCLUDE_DIR=..

# Directory containing the Mod9 ASR C++ Library .so or .a file.
MOD9_ASR_LIB_DIR=..

# Build tools and configuration (using static library).
CC = g++
CPPFLAGS = -I$(MOD9_ASR_INCLUDE_DIR) -I$(NLOHMANN_DIR) -Wall -std=c++11
LDLIBS = -lpthread $(MOD9_ASR_LIB_DIR)/libmod9-asr.a

# Uncomment below or set environment variables to link with a shared version
# of the Mod9 ASR C++ Library.
# LDFLAGS = -L$(MOD9_ASR_LIB_DIR) -Wl,-rpath -Wl,$(shell realpath $(MOD9_ASR_LIB_DIR))
# LDLIBS = -lpthread -lmod9-asr
#
# Note that the built-in runpath references the shared library in its
# original build location. This might not work correctly on some systems
# (e.g. MacOS), so consider installing the library at a path that can be
# found on the system's default load path, or set environment variables
# such as LD_LIBRARY_PATH or DYLD_LIBRARY_PATH at runtime.

all: mod9-asr-example

mod9-asr-example: mod9-asr-example.o

clean:
	rm -f mod9-asr-example.o

distclean: clean
	rm -f mod9-asr-example
