
##************************************************************************
##**
##**
##**  makefile for Video Pipe boot prom monitor with MPEG-2 Transport Layer
##**
##**
##************************************************************************


NAME	=RECVLAYR
ADSP    =2181
EXT     =exe
GOALS   =$(NAME).$(EXT) 
PLATFORM = VIDPIPE


# SOFTSIM defined builds for the software simulator.
# EZKIT defined builds for running in 33 Mhz EZKIT without the 601.
# A command line of "make BUILD=SOFTSIM" will over ride the default
# of FORREAL, permitting debug builds without editing this file.
# Type BUILD and the option in all caps, since the #ifdef preprocessor
# statements in 21XX assembler are case sensitive (just like C).




BUILD = FORREAL
#BUILD = SOFTSIM
#BUILD = EZKIT

#Locate various video pictures in prom
FIRST_PIX  = B500
SECOND_PIX = c000

OBJS	= main.obj intvec.obj\
          tranpes.obj recvpes.obj sport0.obj\
          encisr.obj decisr.obj\
          adv7176.obj  saa7111.obj timertic.obj servo.obj rcurve.obj\
          cputest.obj cardtest.obj ramtest.obj wavetest.obj\
          comdat.obj  adv601.obj  i2c.obj txtfmt.obj\
          fetchpix.obj  tvpix.obj uart.obj command.obj\
          ccaption.obj utility.obj userintf.obj divide.obj sercomm.obj\


AINCS = adsp$(ADSP).h stdsym.h  vidpipe.h comdat.h  
CINCS = $(AINCS)



.SUFFIXES:
.SUFFIXES:  .obj  .dsp .c

ASM     =asm21

# -$(ADSP) selects the brand of 21xx DSP (2105,2181 etc)
# -d$(BUILD) selects FORREAL, EZKIT or SOFTSIM conditional assembly statements
# -l gets a listing file.
# -dAUDIT_TRAIL assembles debug code.  Don't ship that way
# -dADI_LAB likewise assembles debug code. Don't ship that way.
# -dTRANLAYR assembles transport layer code for transmit.
# -dRECVLAYR assembles transport layer code for receive.
# -dTSHOOT assembles all sorts of troubleshooting code
# -dXMIT_AUTOBUF assembles transmitter code for a tranmit only prom
# -dRECV_AUTOBUF assembles receiver code for a receive only prom

#AFLAGS  = -d$(BUILD) -$(ADSP) -l
#AFLAGS  = -d$(BUILD) -$(ADSP) -l -dAUDIT_TRAIL -dADI_LAB
#AFLAGS  = -d$(BUILD) -$(ADSP) -l  -dTRANLAYR -dTSHOOT
#AFLAGS  = -d$(BUILD) -$(ADSP) -l  -dTRANLAYR  -dAUDIT_TRAIL
AFLAGS  = -d$(BUILD) -$(ADSP) -l  -dRECVLAYR -dADI_LAB -dRECV_AUTOBUF 
 



LINK	=ld21
LINKFLAGS = -a $(PLATFORM).ach -g -x 

RC      =rc -r $(ROPT) $(INCLUDES)
RCLINK  =rc $(ROPT) $(INCLUDES)

BLD     = bld21
BLDFLAGS = -c

CC      =g21
CFLAGS  =-a $(PLATFORM).ach  -Wall -c 

# DEFAULT RULES
#
#	ASM -> OBJ (Actually DSP -> OBJ) using ADI 21xx assembler.
.dsp.obj:
    $(ASM) $< $(AFLAGS)
#
#	C -> OBJ (Actually C -> OBJ) using ADI Gnu Compiler assembler.
.c.obj:
    $(CC) $< $(CFLAGS)

#   Make the prom blaster file for burning proms
$(NAME).BNM : $(GOALS) c_ramp.exe 
    spl21 $(NAME) $(NAME) -loader -2181 -bdma c_ramp.exe $(FIRST_PIX) 

#   Make the .exe file for Software Simulator & upload via monitor
$(GOALS) : $(OBJS) $(PLATFORM).ach  linklist.lnk objlist
        $(LINK) -i linklist.lnk  -e $(NAME) $(LINKFLAGS)



tvpix.obj : tvpix.dsp $(AINCS);
    $(ASM) tvpix.dsp $(AFLAGS) -dC_RAMP_PTR=0x$(FIRST_PIX) -dGIRL_PTR=0x$(SECOND_PIX)


# Color Ramp Data

c_ramp.obj : c_ramp.dsp
    
c_ramp.exe : c_ramp.obj
        $(LINK) c_ramp.obj  -e c_ramp $(LINKFLAGS)

    



# write all the object files 
# to a file to keep the cmd line
# to ld21 less than 128 chars
# objlist is a dummy target so that all the objs are newer
# and appear in the $? macro so that get written to the file.
# Otherwise just the ones that got reassembled get linked which
# ain't what we want. 

objlist : $(OBJS)       
    del linklist.lnk                
     !>>linklist.lnk $?,

# Let make know that we care about dummy tgt objlist so he will build it
# Otherwise make figures we don't need objlist, so it doesn't get built

linklist.lnk : objlist

$(OBJS) : $(AINCS) makefile 

$(PLATFORM).ach:	$(PLATFORM).sys
	$(BLD)  $(BLDFLAGS) $*

#$(NAME).obj: $(NAME).c  $(CINCS)





clean:
        -@del *.obj
        -@del *.map
        -@del *.sym
        -@del *.res
        -@del *.ses
        -@del *.cde
        -@del *.bak
        -@del *.int
        -@del *.lst
        -@del *.bnu
        -@del *.bnl
        -@del *.app


listing:
    copy $(NAME).dsp lpt1:

    
