Makefile.dram 4.62 KB
##########################################################################
#
# Makefile for RSP Fast3D graphics microcode
#
##########################################################################

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

#
UCODE = gspF3DEX
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 -DSTATICQDIV \
	-DBRANCH_Z -DSWITCH_UCODE

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

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

GDIRT  = *.u $(UCODE).dram

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 	\
		../gsetup.s ../gclip.s ../gflight.s ../newt.s	\
		../goverlays.s ../goutdram.s ../ginit.s 	\
		../gsetup1.s ../gboot.s ../gloaduc.s

INST_LIB_TARGETS = 	$(UCODE).dram.o

TARGETS =	$(UCODE).dram				\
		$(UCODE).dram.u.tvd			\
		gclip.only.dram.u.tvd			\
		gflight.dram.u.tvd			\
		gdone.dram.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 dram:
#
$(UCODE).dram:	$(UCODE).dram.u newt.u gclip.only.dram.u gflight.dram.u gdone.dram.u gboot.dram.u
	${BUILDTASK} -f 1 -o $@ -s 34 -p gboot.dram.u $(UCODE).dram.u -l 34 $(UCODE).dram.u gclip.only.dram.u gflight.dram.u gdone.dram.u
	dd if=$@.dat of=tmp3.dat bs=1 count=2048
	mv tmp3.dat $@.dat

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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