#
# All application Makefiles should define the following macros:
#
#   NETOS_DIR       :  relative path to the "netos" toplevel
#   BUILD_RAM_IMAGE :  set to "0" if not desired, and to "1"
#                      if desired (and supported by platform)
#   BUILD_ROM_IMAGE :  set to "0" if not desired, and to "1"
#                      if desired (and supported by platform)
#   APP_C_FILES     :  list of application specific "C" files
#                      (must all have a ".c" suffix)
#   APP_C_FLAGS     :  application specific CFLAGS
#   APP_CC_FILES    :  list of application specific "C++" files
#                      (must all have either a ".cc", ".C", or ".cxx" suffix)
#   APP_CC_FLAGS    :  application specific CFLAGS for C++ compilation
#   APP_ASM_FILES   :  list of application specific assembly files
#                      (must all have either a ".s", ".S", or ".arm" suffix)
#   APP_ASM_FLAGS   :  application specific ASFLAGS for assembly
#   APP_INCDIRS     :  list of application specific include directories
#                      in "-I.." format.
#
#   APP_DESCRIPTION :  Simple one line description of application
#                      (for applicable platforms, will be incorporated
#                      into the binary VPD)
#
#   USE_SIMPLE_WEB_SERVER : set to "1" if desired (used for compatibility
#                           with older examples... links against a different
#                           set of libraries)
#
#   INCLUDE_CXX_STARTUP : set to "1" to include C++ initialization libraries
#
#   APP_OBJ_FILES   :  An optional veriable which can specify "extra"
#                      objects to be linked into an image which are
#                      not derived from c, c++, or assembly.  The
#                      application Makefile bears the burden of providing
#                      rules to build these files if necessary.
#
# The application Makefile should also include VPATH specifications
# for all application source.
#

NETOS_DIR= ../../../..

#
# Including Makefile.bsp to get settings for WIRELESS_PLATFORM and 
# GRAPHICS_PLATFORM.
#
include $(NETOS_DIR)/src/bsp/platforms/$(PLATFORM)/Makefile.bsp

#
# Include Makefile.example to get a list of examples the current 
# platform supports.
include $(NETOS_DIR)/src/bsp/platforms/$(PLATFORM)/Makefile.example

#
# Set APP_NAME to the name of this example application.  The name must
# match one of the names set by Makefile.example in platforms that 
# support this app.
#
APP_NAME=nai2s

#
# The description below will appear in the power on dialog.
#
APP_DESCRIPTION="NET+OS I2S Example Application"

#
# Make sure this example is supported by the current platform.
#
ifneq ($(findstring $(APP_NAME), $(EXAMPLES)),)
else
$(error $(APP_NAME) is not supported by $(PLATFORM), check readme for more information)
endif


#
# Set this constant to build image.elf.
#
BUILD_RAM_IMAGE= 1

#
# Set this constant to build rom.bin.
#
BUILD_ROM_IMAGE= 0

#
# Set this flag to TRUE if your application uses graphics.
#
GRAPHICS_ENABLED= FALSE

#
# Set this flag to TRUE if your application uses realport.
#
REALPORT_ENABLED= FALSE

# CXX is needed if realport or graphics is enabled
ifeq '$(GRAPHICS_ENABLED)' 'TRUE'
INCLUDE_CXX_STARTUP= 1
endif

#
# List the source paths for your application C files here.
#
vpath %.c ..

#
# List the source paths for your application C++ files here.
#
vpath %.cxx ..


#
# List the C source files for your application here.
#
APP_C_FILES=root.c

#
# List the C++ source files for your application here.
#
APP_CC_FILES=

#
# List the assembler files for your application here.
#
APP_ASM_FILES=

#
# Add any flags needed by your application here. These
# switches will be passed to the C Compiler command line.
#
APP_C_FLAGS= -DAPP_FILE_SYSTEM

ifeq '$(GRAPHICS_ENABLED)' 'TRUE'
APP_C_FLAGS += -D__WXNETOS__ -D__WXUNIVERSAL__ 
endif

#
# Add any C++ flags needed by your application here.  These 
# switches will be passed to the C++ compiler command line.
#
APP_CC_FLAGS=
ifeq '$(GRAPHICS_ENABLED)' 'TRUE'
APP_CC_FLAGS += -xc++ -D__WXNETOS__ -D__WXUNIVERSAL__  -fno-rtti
endif

#
# Add any assembler flags needed by your application here.  These
# switches will be passed to the assembler command line.
#
APP_ASM_FLAGS=

#
# Add any include directories needed by your application here.
#
APP_INCDIRS= -I.. 
ifeq '$(GRAPHICS_ENABLED)' 'TRUE'
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/graphics -I$(NETOS_DIR)/src/shared/freetype
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/freetype/custom 
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/freetype/ft_dist/include 
APP_INCDIRS += -I$(NETOS_DIR)/h/usb_host 
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/graphics 
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/graphics/wxWidgets/netos/lib/wx/include/netosuniv-ansi-release-2.8
APP_INCDIRS += -I$(NETOS_DIR)/src/shared/graphics/wxWidgets/include
APP_INCDIRS += -I$(NETOS_DIR)/src/usb_host_drivers/usb_magstripe 
APP_INCDIRS += -I$(NETOS_DIR)/src/usb_host_drivers/keyboard 
APP_INCDIRS += -I$(NETOS_DIR)/src/usb_host_drivers/mouse 
APP_INCDIRS += -I$(NETOS_DIR)/src/usb_host_drivers/hub
endif



# 
# List of typical libraries used by NET+OS applications.
#
APP_LIBS =  $(NETOS_BSPLIBPATH)/libbsp.a \
            $(NETOS_LIBPATH)/libflash.a \
            $(NETOS_LIBPATH)/libtx.a \
            $(NETOS_LIBPATH)/libdnsclnt.a \
            $(NETOS_LIBPATH)/libaddp.a \
            $(NETOS_LIBPATH)/libftpsvr.a \
            $(NETOS_LIBPATH)/libtcpip.a \
            $(NETOS_LIBPATH)/libtelnsvr.a \
            $(NETOS_LIBPATH)/libedp.a \
            $(NETOS_LIBPATH)/libz.a	\
            $(NETOS_LIBPATH)/libftpsvr.a \
            $(NETOS_LIBPATH)/libfilesys.a \
            $(NETOS_LIBPATH)/libemailc.a \
            $(NETOS_LIBPATH)/librphttpd.a \
            $(NETOS_LIBPATH)/libmanapi.a \
            $(NETOS_LIBPATH)/librealport.a \
            $(NETOS_LIBPATH)/libssl.a \
            $(NETOS_LIBPATH)/libcrypto.a \
            $(NETOS_LIBPATH)/libssh.a \
            $(NETOS_LIBPATH)/libwpa.a \
            $(NETOS_LIBPATH)/libwps.a \
            $(NETOS_LIBPATH)/libcrypto.a \
            $(NETOS_LIBPATH)/libssl.a \
            $(NETOS_LIBPATH)/libposix.a

#
# List of additional libraries used by graphics applications.
#
ifeq '$(GRAPHICS_ENABLED)' 'TRUE'
APP_LIBS += $(NETOS_LIBPATH)/libfreetype.a \
            $(NETOS_LIBPATH)/libgfx.a \
            $(NETOS_LIBPATH)/libwxwidgets.a \
            $(NETOS_LIBPATH)/libz.a
endif

#
# Add any additional libraries here.
#
APP_LIBS += 

#########################################################
# Makefile.tools requires BASEDIR for appropriate BSP 
#
BASEDIR =$(NETOS_DIR)

#
# Include common compiler tools setup.
#
-include $(NETOS_DIR)/Makefile.tools

#
# List of USB libraries, which are included for ARM9 based platforms.
#
ifneq ($(findstring $(PROCESSOR), $(USB_HOST_PROCESSORS)),)
APP_LIBS += $(NETOS_LIBPATH)/libusbhub.a \
            $(NETOS_LIBPATH)/libusbwifi.a \
            $(NETOS_LIBPATH)/libusbhost.a \
            $(NETOS_LIBPATH)/libusbprinter.a \
            $(NETOS_LIBPATH)/libusbkeyboard.a \
            $(NETOS_LIBPATH)/libusbmassstorage.a \
            $(NETOS_LIBPATH)/libusbmouse.a
endif

#
# All "required" elements must be supplied prior to including the
# "core" Makefile and targets.
#

include $(NETOS_DIR)/src/linkerScripts/Makefile.app.inc

#
# Application specific macros and targets can go below here.
#
