#######################################################################
#
# Makefile: hoaReferenceEncoder example
#
#######################################################################

# include the general makefiles using this directive

CXX11=1#  # Removes -ansi and adds std=c++0x to CFLAGS
GENERALROOT=../../../../
MAKEROOT=../

-include $(GENERALROOT)/general/makefile.all
CXX11=1
# the following directive is mandatory in order to get all local stuff into this level
ifeq "$(MAKELEVEL)" "0"

SRCS = main.cpp
CXX11=1
SRCDIRS +=  ../src

INCL = -I../../common/include -I../../hoaEncLib/include -I../../hoaRenderer/binaural -I../../../../tools/AFspCppWrap/wavWriter/include \
       -I../../spatialCoder/spatialDecoding/include -I$(GENERALROOT)/tools/AFsp/include 

COMLIBS +=  -lHoaEncoder -lCHoaBitStreamW -lBitStreamWriter -lSpatialEncoding -lSpatialDecoding -lparDecorrelator -lqmflibCppWrap -lwavReader -lwavWriter -lfft

# AFSP FILE PATH
ifeq "$(TARGET_SYSTEM)" "Linux"
ifeq "$(TARGET_PLATFORM)" "x86_64"
 AFSP_LIB =  $(GENERALROOT)/tools/AFsp/lib/libtsplite_x86_64.a
else
 AFSP_LIB =  $(GENERALROOT)/tools/AFsp/lib/libtsplite.a
endif
endif

ifeq "$(TARGET_SYSTEM)" "Darwin"
 AFSP_LIB = $(GENERALROOT)/tools/AFsp/lib/libtsplite_Mac.a
endif

OPTIONS  += SRCDIRS="$(SRCDIRS)" INCL="$(INCL)" LIBPATH="$(LIBPATH)" SYSLIBS="$(AFSP_LIB)" INCLDEP=1 DEFFLAGS="$(DEFFLAGS)" PLOT="$(PLOT)" GPROF="$(GPROF)"


# MAKEFILE RULES AND DEPENDENCIES ######################################
# the first rule `all' has to depend from makefile.all
all: $(GENERALROOT)/general/makefile.all hoaReferenceEncoder


hoaReferenceEncoder:
	@echo $(DEFFLAGS)
	@$(MAKE) TARGET=$@ $(OPTIONS) COMLIBS="$(COMLIBS)" SYSLIBS="$(AFSP_LIB)" CFLAGS="$(CFLAGS)" SRCS="$(SRCS)" binary

clean:
	@$(MAKE) TARGET="hoaReferenceEncoder" SRCS="$(SRCS)" clean

clean_all:
	@$(MAKE) TARGET="hoaReferenceEncoder" OBJS="$(OBJS)" COMLIBS="$(COMLIBS)" clean

endif

