CCS = /home/a0324034/ti/ccs521
CGTOOLS = $(CCS)/ccsv5/tools/compiler/tms470_4.9.5
XDCTOOLS = $(CCS)/xdctools_3_23_03_53
SYSBIOS = $(CCS)/bios_6_33_05_46

CC = $(CGTOOLS)/bin/cl470
LNK = $(CGTOOLS)/bin/lnk470
RTS = $(CGTOOLS)/lib/libc.a
XS = $(XDCTOOLS)/xs

CONFIG = system
XDCTARGET = ti.targets.arm.elf.Arm9
XDCPLATFORM = ti.platforms.evmOMAPL138

.PRECIOUS: %/compiler.opt %/linker.cmd

%/linker.cmd %/compiler.opt : %.cfg
	$(XS) --xdcpath=$(SYSBIOS)/packages xdc.tools.configuro -c $(CGTOOLS) -t $(XDCTARGET) -p $(XDCPLATFORM) $<

%.obj : %.c $(CONFIG)/compiler.opt
	$(CC) -@$(CONFIG)/compiler.opt -c $<

hello.out : hello.obj $(CONFIG)/linker.cmd
	$(LNK) -o hello.out -c hello.obj $(CONFIG)/linker.cmd $(RTS)

clean:
	rm -f *.obj *.out
	rm -rf $(CONFIG)
