#
#  *** Note: You must use gmake to build with this makefile ***
#
#  Makefile for creation of the program named by the PROG variable
#
#  The following naming conventions are used by this makefile:
#       mailbox.asm      - C28 assembly language source file
#       mailbox.obj      - C28 object file (compiled/assembled source)
#       mailbox.out      - C28 executable (fully linked program)
#       mailboxcfg.s28   - configuration assembly source file generated
#                         by Configuration Tool
#       mailboxcfg.h28   - configuration assembly header file generated
#                         by Configuration Tool
#       mailboxcfg_c.c   - configuration assembly header file generated
#                         by Configuration Tool
#       mailboxcfg.h     - configuration assembly header file generated
#                         by Configuration Tool
#       mailboxcfg.cmd   - configuration linker command file generated
#                         by Configuration Tool
#

ifndef COMMON_DIR
    COMMON_DIR = $(BIOS_INSTALL_DIR)/packages/ti/bios/examples/common
endif

#specify command line options to be used when calling Tconf
TCONFOPTS=-Dconfig.importPath="$(PLATFORMS_ROOT)/packages;$(COMMON_DIR);.."
TCIS	= $(COMMON_DIR)/ezdsp28335_common.tci mailbox_ezdsp28335_custom.tci

#  Flags - Specify platform specific compiler options here

CC28FLAGS = -c -d"LARGE_MODEL"  -ml -v28 --float_support=fpu32
AS28FLAGS = -d"LARGE_MODEL" -ml -v28 --float_support=fpu32
LD28FLAGS =  -m"mailbox.map"

include $(COMMON_DIR)/config.mak
include $(COMMON_DIR)/c28rules.mak

#  Every BIOS program must be linked with:
#       $(PROG)cfg.obj  - object resulting from assembling $(PROG)cfg.s28
#       $(PROG)cfg_c.obj- object resulting from compiling $(PROG)cfg_c.c
#       $(PROG)cfg.cmd  - linker command file generated by Config Tool. If
#                         additional liner command files exist, $(PROG)cfg.cmd
#                         must appear first.
#

PROG	= mailbox
OBJS	= $(PROG)cfg.obj $(PROG)cfg_c.obj 
CMDS	= $(PROG)cfg.cmd

#
#  Targets:
#
all: $(PROG).out

$(PROG).out: $(OBJS) $(CMDS)

.tconfdebug:
	$(TCONF) -g $(TCONFOPTS) $(PROG).tcf

.clean clean::
	@ echo removing generated configuration files ...
	@$(REMOVE) $(PROG)cfg.s28 $(PROG)cfg.h28 $(PROG)cfg.cmd
	@$(REMOVE) $(PROG)cfg_c.c $(PROG)cfg.h $(PROG).cdb
	@ echo removing object files and binaries ...
	@$(REMOVE) *.obj *.out *.lst *.map
