Makefile 4.72 KB
##########################################################################
#
# Makefile for RSP Fast3D graphics microcode
#
##########################################################################

PRDEPTH=../../../
include $(PRDEPTH)/PRdefs

#
UCODE = gspF3DLX.NoN
GMAIN = ../gmain.s

# local defs
#LCDEFS = $(HW_FLAGS) -DFAST3D -DCLIP_ON -DNOFRONTREJ -DSMARTDLCOUNT -DSMARTINP
LCDEFS = $(HW_FLAGS) -DFAST3D -DSMARTDLCOUNT -DSMARTINP -DMTXNOLMT \
	-DMOREDLLNK -DRETGFX1 -DF3DEX_GBI -DFASTYSORT -DNOSUBPIXEL \
	-DNEAR_CLIP_OFF -DDMANOWAIT -DCLIPSWITCH -DSTATICQDIV -DBRANCH_Z \
	-DSWITCH_UCODE

# local includes
LCINCS = -I. -I.. -I../F3DLX -I$(ROOT)/usr/include -I$(ROOT)/usr/include/PR

LDIRT = *.dat *.lst *.sym *.dbg *.elf *.tvd *~ \
		gfillnops.s gfillnops.dram.s gfillnops.fifo.s

GDIRT = *.u $(UCODE).fifo

GFX_INCL = 	../gdmem.h ../gfx_regs.h

#
# this microcode uses all "common" microcode:
#
GFX_CODE = 	$(GMAIN) ../gyield.s ../gdma.s ../gimm.s \
		../grdp.s ../gdone.s ../gmtx.s ../gvtx.s \
		../F3DLX/glxsetup.s ../gclip.s ../gflight.s \
		../newt.s ../goverlays.s ../goutxbus.s	\
		../goutdram.s ../goutfifo.s ../ginit.s	\
		../gsetup1.s ../gboot.s ../gloaduc.s

INST_LIB_TARGETS = 	$(UCODE).fifo.o

TARGETS =	$(UCODE).fifo				\
		$(UCODE).fifo.u.tvd			\
		gclip.only.fifo.u.tvd			\
		gflight.fifo.u.tvd			\
		gdone.fifo.u.tvd			\
		${INST_LIB_TARGETS}

default: ${TARGETS} checksize

install exports: ${TARGETS} checksize
	$(INSTALL) -m 555 -F /usr/lib/PR $(INST_LIB_TARGETS)

#
# what the heck is this?
#
ig: 	$(UCODE) $(UCODE).u.tvd gclip.only.u.tvd gflight.u.tvd \
	gdone.u.tvd $(UCODE).o 
	$(INSTALL) -m 555 -F /usr/lib/PR $(UCODE).o

include $(PRDEPTH)/PRrules

##########################################################################
#
# use the RSP linker 'buildtask' to construct the tasks from the objects.
# use the rsp2elf program to construct the debug executables and library
# executables.
#
# 'dd' is used to chop the data section to the minimum required, in
# order to save ROM/RAM space.
#

#
# the 3D polygon ucode with output to circular DRAM fifo:
#
$(UCODE).fifo:	$(UCODE).fifo.u newt.u gclip.only.fifo.u gflight.fifo.u gdone.fifo.u gboot.fifo.u
	${BUILDTASK} -f 1 -o $@ -s 34 -p gboot.fifo.u $(UCODE).fifo.u -l 34 $(UCODE).fifo.u gclip.only.fifo.u gflight.fifo.u gdone.fifo.u
	dd if=$@.dat of=tmp3.dat bs=1 count=2048
	mv tmp3.dat $@.dat

$(UCODE).fifo.o:	$(UCODE).fifo
	${RSP2ELF} -p -r $?

$(UCODE).fifo.u.tvd:	$(UCODE).fifo
	${RSP2ELF} -p $(UCODE).fifo.u

gclip.only.fifo.u.tvd:	$(UCODE).fifo
	${RSP2ELF} -p gclip.only.fifo.u

gflight.fifo.u.tvd:	$(UCODE).fifo
	${RSP2ELF} -p gflight.fifo.u

gdone.fifo.u.tvd:	$(UCODE).fifo
	${RSP2ELF} -p gdone.fifo.u

#
# Ensure IMEM size does not overflow
#
checksize:	${INST_LIB_TARGETS}
	../sizecheck ${INST_LIB_TARGETS}
	../labeltest


#############################################################################
#
# build the individual objects.
#

newt.u:	$(UCODE).fifo.u ../newt.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DNEWT_ALONE -S $(UCODE).fifo.u -o $@ ../newt.s

$(UCODE).fifo.u: gclip.only_tmp.fifo.u gflight.fifo.u ../fillnops $(UCODE)_tmp.fifo.u ${GFX_INCL} ${GFX_CODE}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	../fillnops gclip.only_tmp.fifo.u.dbg clipKill $(UCODE)_tmp.fifo.u.dbg clipAndSetup 1 > gfillnops.fifo.s
	${RSPASM} ${LCINCS} ${LCDEFS} -DFASTLIGHT3D -DOUTPUT_FIFO -o $@ -S gclip.only_tmp.fifo.u $(GMAIN)
	@echo " "

gboot.fifo.u: $(UCODE).fifo.u ../gboot.s
	${RSPASM} ${LCINCS} ${LCDEFS} -o $@ -S $(UCODE).fifo.u ../gboot.s

$(UCODE)_tmp.fifo.u:	${GFX_INCL} ${GFX_CODE}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DFASTLIGHT3D -DNODATA -DOUTPUT_FIFO -o $@ $(GMAIN)
	@echo " "

gclip.only_tmp.fifo.u:	$(UCODE)_tmp.fifo.u ../goverlays.s ../gclip.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DCLIP_ALONE -DPRECISE_CLIP -DNODATA -DOUTPUT_FIFO -o $@ -S $(UCODE)_tmp.fifo.u ../goverlays.s

gclip.only.fifo.u:	$(UCODE).fifo.u ../goverlays.s ../gclip.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DCLIP_ALONE -DPRECISE_CLIP -DNODATA -DOUTPUT_FIFO -o $@ -S $(UCODE).fifo.u ../goverlays.s

gflight.fifo.u:		$(UCODE)_tmp.fifo.u ../gflight.s ../goverlays.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DFLIGHT -DNODATA  -DOUTPUT_FIFO -o $@ -S $(UCODE)_tmp.fifo.u ../goverlays.s

gdone.fifo.u:		$(UCODE)_tmp.fifo.u ../gdone.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DFASTLIGHT3D -DNODATA -DOUTPUT_FIFO -o $@ -S $(UCODE)_tmp.fifo.u ../gdone.s

# DO NOT DELETE THIS LINE -- make depend depends on it.