#######################################################################
#
# Makefile: hoaReferenceDecoder 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

# the following directive is mandatory in order to get all local stuff into this level
ifeq "$(MAKELEVEL)" "0"

SRCS = main.cpp

SRCDIRS +=  ../src

INCL = -I../../common/include -I../../hoaDecLib/include -I../../../../tools/AFspCppWrap/wavWriter/include

INCL+= -I$(GENERALROOT)/tools/AFsp/include

COMLIBS +=  -lHoaDecoder -lCHoaBitStreamR -lBitStreamReader -lRenderHoa -lqmflibCppWrap -lSpatialDecoding -lparDecorrelator -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)" GLOBOPTS="$(GLOBOPTS)"


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

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

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

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

endif

