#
#  *** 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:
#       hello.asm      - C62 assembly language source file
#       hello.obj      - C62 object file (compiled/assembled source)
#       hello.out      - C62 executable (fully linked program)
#       hellocfg.s62   - configuration assembly source file generated
#                         by Configuration Tool
#       hellocfg.h62   - configuration assembly header file generated
#                         by Configuration Tool
#       hellocfg_c.c   - configuration assembly header file generated
#                         by Configuration Tool
#       hellocfg.h     - configuration assembly header file generated
#                         by Configuration Tool
#       hellocfg.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)/dsk6416_common.tci

#  Flags - Specify platform specific compiler options here

CC6xFLAGS = -c -mv6400
AS6xFLAGS = -mv6400
LD6xFLAGS =  -m"hello.map"

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

#  Every BIOS program must be linked with:
#       $(PROG)cfg.obj  - object resulting from assembling $(PROG)cfg.s62
#       $(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	= hello
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.s62 $(PROG)cfg.h62 $(PROG)cfg.cmd
	@$(REMOVE) $(PROG)cfg_c.c $(PROG)cfg.h $(PROG).cdb
	@ echo removing object files and binaries ...
	@$(REMOVE) *.obj *.out *.lst *.map
