VERSION = 5.5.0

DEBUG ?= 0

ifeq ($(DEBUG),1)
DEBUG_FLAGS = -g -DXASSERT_ENABLE_ASSERTIONS=1 -DXASSERT_ENABLE_DEBUG=1 -DXASSERT_ENABLE_LINE_NUMBERS=1
else
DEBUG_FLAGS = -DXASSERT_ENABLE_ASSERTIONS=0 -DXASSERT_ENABLE_DEBUG=0 -DXASSERT_ENABLE_LINE_NUMBERS=0
endif

DEPENDENT_MODULES = lib_adat(>=2.0.1) \
                    lib_locks(>=2.4.0) \
                    lib_logging(>=3.4.0) \
                    lib_spdif(>=7.0.0) \
                    lib_sw_pll(>=2.4.1) \
                    lib_xassert(>=4.3.2) \
                    lib_xud(>=4.0.1) \
                    lib_mic_array(>=7.0.0) \
                    lib_dfu(>=2.1.0)

MODULE_XCC_FLAGS = $(XCC_FLAGS) \
                   -O3 \
                   -fasm-linenum \
                   -fcomment-asm \
                    $(DEBUG_FLAGS)

# Core
XCC_FLAGS_xua_endpoint0.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_xua_ep0_uacreqs.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_dbcalc.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_audioports.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_audioports.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue

# DFU
XCC_FLAGS_dfu.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue

OPTIONAL_HEADERS += xua_conf.h \
					xua_conf_globals.h \
					xua_conf_declarations.h \
					xua_conf_cores.h \
					xua_conf_tasks.h \
                    xua_conf_dfu.h \
					static_hid_report.h \
					xua_user_descriptors_incl.h \
					xua_user_descriptors_decl.h \
					xua_user_descriptors_content.h \
					xua_user_endpoint_init.h \
					xua_user_ep0_decl.h \
					xua_user_ep0_handler.h

EXPORT_INCLUDE_DIRS = api \
                      src/core \
                      src/core/audiohub \
                      src/core/buffer/ep \
                      src/core/endpoint0 \
                      src/dfu

INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \
               src/core/buffer/decouple \
               src/core/clocking \
               src/core/mixer \
               src/core/pdm_mics \
               src/core/ports \
               src/core/support \
               src/core/user \
               src/core/user/audiostream \
               src/core/user/audiohw \
               src/core/user/hid \
               src/core/user/hostactive \
               src/core/user/suspend \
               src/hid \
               src/midi \
               src

SOURCE_DIRS = src/core \
              src/core/audiohub \
              src/core/buffer/decouple \
              src/core/buffer/ep \
              src/core/clocking \
              src/core/endpoint0 \
              src/core/mixer \
              src/core/pdm_mics \
              src/core/ports \
              src/core/support \
              src/core/user/audiostream \
              src/core/user/audiohw \
              src/core/user/hostactive \
              src/core/user/suspend \
              src/core/xuduser \
              src/dfu \
              src/hid \
              src/midi

EXCLUDE_FILES += descriptors_2.rst
