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

UCPATH=../..

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

#
UCODE = gspF3DEX
GMAIN = $(UCPATH)/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$(UCPATH) -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 = 	$(UCPATH)/gdmem.h $(UCPATH)/gfx_regs.h

#
# this microcode uses all "common" microcode:
#
GFX_CODE = 	$(GMAIN) $(UCPATH)/gyield.s $(UCPATH)/gdma.s		\
		$(UCPATH)/gimm.s $(UCPATH)/grdp.s $(UCPATH)/gdone.s	\
		$(UCPATH)/gmtx.s $(UCPATH)/gvtx.s $(UCPATH)/gsetup.s	\
		$(UCPATH)/gclip.s $(UCPATH)/gflight.s $(UCPATH)/newt.s	\
		$(UCPATH)/goverlays.s $(UCPATH)/goutdram.s		\
		$(UCPATH)/ginit.s $(UCPATH)/gsetup1.s $(UCPATH)/gboot.s	\
		$(UCPATH)/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}
	$(UCPATH)/sizecheck ${INST_LIB_TARGETS}
	$(UCPATH)/labeltest


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

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

$(UCODE).dram.u: gclip.only_tmp.dram.u gflight.dram.u $(UCPATH)/fillnops $(UCODE)_tmp.dram.u ${GFX_INCL} ${GFX_CODE}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	$(UCPATH)/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 $(UCPATH)/gboot.s
	${RSPASM} ${LCINCS} ${LCDEFS} -o $@ -S $(UCODE).dram.u $(UCPATH)/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 $(UCPATH)/goverlays.s $(UCPATH)/gclip.s ${GFX_INCL}
	@echo "****"
	@echo "**** Building $@:"
	@echo "****"
	${RSPASM} ${LCINCS} ${LCDEFS} -DCLIP_ALONE -DPRECISE_CLIP -DNODATA -DOUTPUT_DRAM -o $@ -S $(UCODE)_tmp.dram.u $(UCPATH)/goverlays.s

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

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

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

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