CODEGEN_INSTALLATION_DIR = $(ti.targets.arm.elf.M4)
CC = $(ti.targets.arm.elf.M4)/bin/armcl
LD = $(ti.targets.arm.elf.M4)/bin/armcl -z

XDCPATH = $(NS_INSTALLATION_DIR)/packages/;$(BIOS_INSTALLATION_DIR)/packages;$(TIRTOS_INSTALLATION_DIR)/packages;$(UIA_INSTALLATION_DIR)/packages;$(CC3200SDK_INSTALLATION_DIR)/simplelink_extlib/provisioninglib
CONFIGURO = $(XDCTOOLS_INSTALLATION_DIR)/xs --xdcpath="$(XDCPATH)" xdc.tools.configuro

TARGET = ti.targets.arm.elf.M4
PLATFORM = ti.platforms.simplelink:CC3200
PROFILE = release

CFLAGS = -eo=.o -mv7M4 --float_support=vfplib --abi=eabi -me -ms --c99 -I$(ti.targets.arm.elf.M4)/include -I$(CCWARE_INSTALLATION_DIR) -I$(CCWARE_INSTALLATION_DIR)/inc -I$(CCWARE_INSTALLATION_DIR)/driverlib -I$(CC3200SDK_INSTALLATION_DIR)/oslib -I$(CC3200SDK_INSTALLATION_DIR)/ti_rtos -I$(CC3200SDK_INSTALLATION_DIR)/simplelink -I$(CC3200SDK_INSTALLATION_DIR)/simplelink/include -I$(CC3200SDK_INSTALLATION_DIR)/simplelink/Source -Dccs -DPART_CC3200 -DCCWARE -DSL_FULL -DSL_PLATFORM_MULTI_THREADED -DNET_SL

LFLAGS = --rom_model --warn_sections -i$(CODEGEN_INSTALLATION_DIR)/lib --reread_libs -l$(CC3200SDK_INSTALLATION_DIR)/simplelink/ccs/OS/simplelink.a -l$(CC3200SDK_INSTALLATION_DIR)/oslib/ccs/ti_rtos/ti_rtos.a -l$(CCWARE_INSTALLATION_DIR)/driverlib/ccs/Release/driverlib.a -llibc.a

%.o : %.c
	$(CC) $(CFLAGS) -c $<

% : %.cfg
	$(CONFIGURO) -c $(CODEGEN_INSTALLATION_DIR) -t $(TARGET) -p $(PLATFORM) -r $(PROFILE) $<

ifeq ("$(SHELL)","sh.exe")
#For Windows
        RMDIR  = rmdir /S /Q
        remove = del $(subst /,\,$1)
        binconv = $(NS_INSTALLATION_DIR)/tools/elf2cc32.exe
else
#For Linux
        RMDIR  = rm -rf
        remove = rm -f $1
        binconv = $(NS_INSTALLATION_DIR)/tools/elf2cc32
endif
