
#
# Macro definitions referenced below
#
empty =
space =$(empty) $(empty)
CC = "$(C66X_GEN_INSTALL_DIR)/bin/"cl6x -c -mv6600 --abi=elfabi
AC = "$(C66X_GEN_INSTALL_DIR)/bin/"cl6x -c -mv6600 --abi=elfabi
ARIN = "$(C66X_GEN_INSTALL_DIR)/bin/"ar6x rq
LD = "$(C66X_GEN_INSTALL_DIR)/bin/"lnk6x --abi=elfabi 
CGINCS = $(strip $(subst $(space),\$(space),$(C66X_GEN_INSTALL_DIR)/include))
RTSLIB = -l "$(C66X_GEN_INSTALL_DIR)/lib/rts6600_elf.lib"
INCS = -I. -I$(strip $(subst ;, -I,$(subst $(space),\$(space),$(subst \,/,$(INCDIR)))))
OBJEXT = oe66
AOBJEXT = se66
INTERNALDEFS =  -Dti_targets_elf_C66 -Dxdc_target_types__=ti/targets/std.h -eo.$(OBJEXT) -ea.$(AOBJEXT) -fr=$(@D) -fs=$(@D) -ppa -ppd=$@.dep 
INTERNALLINKDEFS =  -o $@ -m $@.map
OBJDIR = ./obj


#List the newMpegTsCode Files
NEWMPEGTSCODEC= \
    tsdemuxpes.c\
    tsdemux.c\
    tsdemuxdesc.c\
    tsutils.c\
    tsmux.c

all: lib/ts.ae66


# FLAGS for the newMpegTsCode Files
NEWMPEGTSCODECFLAGS =  -c -k -q --mem_model:data=far -al -pds1111 -pds827 -pds824 -pds837 -pds1037 -pds195 -pdsw225 -pdsw994 -pdsw262 -pds77 -pden -pds232 --consultant -mw -os -g -mi10000 -as -ss -o3 --optimize_with_debug 

# Make Rule for the newMpegTsCode Files
NEWMPEGTSCODECOBJS = $(patsubst %.c, $(OBJDIR)/%.$(OBJEXT), $(NEWMPEGTSCODEC))

$(NEWMPEGTSCODECOBJS): $(OBJDIR)/%.$(OBJEXT): %.c
	-@echo cle66 $< ...
	if [ ! -d $(@D) ]; then $(MKDIR) $(@D) ; fi;
	-$(RM) $@.dep
	$(CC) $(NEWMPEGTSCODECFLAGS) $(INTERNALDEFS) $(INCS) -I$(CGINCS) -fc $< 
	-@$(CP) $@.dep $@.pp; \
         $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
             -e '/^$$/ d' -e 's/$$/ :/' < $@.pp >> $@.dep; \
         $(RM) $@.pp 


lib/ts.ae66 : $(NEWMPEGTSCODECOBJS)
	@echo archiving $? into $@ ...
	$(ARIN) $@ $?

clean:
#	rm $(NEWMPEGTSCODECOBJS) $(patsubst %.$(OBJEXT),%.cif,$(NEWMPEGTSCODECOBJS)) $(patsubst %.$(OBJEXT),%.lst,$(NEWMPEGTSCODECOBJS)) $(patsubst %.$(OBJEXT),%.oe66.dep,$(NEWMPEGTSCODECOBJS)) $(patsubst %.$(OBJEXT),%.se66,$(NEWMPEGTSCODECOBJS))
	-rm $(OBJDIR)/*
	-rm lib/ts.ae66
