Makefile 4.16 KB
#----------------------------------------------------------------------#
#	Copyright (C) 1997, Nintendo.
#	
#	File		Makefile
#	Coded    by	Yoshitaka Yasumoto.	Oct 15, 1997.
#	
#	$Id: Makefile,v 1.1.1.1 2002/05/02 03:29:11 blythe Exp $
#----------------------------------------------------------------------#

#-----------------------------------------------------------------------------
include		$(ROOT)/usr/include/make/PRdefs

DEFINES =	-DDEBUG
#SUBDIRS =       F3DEX2
#SUBDIRS =       S2DEX2
SUBDIRS =	F3DEX2 F3DEX2.NoN F3DEX2.Rej F3DLX2.Rej L3DEX2 S2DEX2
COMMONPREF =	F3DEX2
SUBPKGS = 	debug

#SAFE_MODE =
#SAFE_MODE =	-DSAFE_MODE

include		$(COMMONRULES)

default:	$(_FORCE)
	@for i in $(SUBDIRS) ; do \
		( cd $$i ; \
		echo ======== $$i.fifo ======== ; \
		$(MAKE) -f ../Makefile UCODE=$$i OUTTYPE=fifo gsp$$i.fifo.o ; \
		echo ======== $$i.xbus ======== ; \
		$(MAKE) -f ../Makefile UCODE=$$i OUTTYPE=xbus gsp$$i.xbus.o );\
	done
	@for i in $(SUBPKGS) ; do \
		( cd $$i ; $(MAKE) );\
	done
	@echo \
	----------------------------------------------------------------------
	@strings -30 */gsp*.o
	@echo \
	----------------------------------------------------------------------
	@for i in $(SUBPKGS) ; do \
		( cd $$i ; strings -30 */gsp*.o ); \
	echo \
	----------------------------------------------------------------------;\
	done

safemode:	$(_FORCE)
	( SAFE_MODE=-DSAFE_MODE; export SAFE_MODE; make default )

clean clobber:	$(_FORCE)
	@for i in $(SUBDIRS) ; do \
		echo ======== $$i ======== ; \
		( cd $$i ; \
		$(MAKE) -f    ../Makefile UCODE=$$i $(COMMONPREF)$@ );\
	done
	@for i in $(SUBPKGS) ; do \
		( cd $$i ; $(MAKE) $@ );\
	done
	@rm -f *~ doc/*~ Tools/*~

install exports: default
	$(INSTALL) -m 444 -F /usr/src/PR/rspcode/graphics.F3DEX2 \
		$(MAIN) $(COMMON_SRCS) $(COMMON_HDRS) Makefile \
		Tools/binHack.perl
	(cd doc; $(INSTALL) -m 444 -F /usr/src/PR/doc/gfxucode.F3DEX2 $(DOCS))
	@for i in $(SUBDIRS) ; do \
		echo ======== $$i ======== ; \
		( cd $$i ; $(MAKE) -f ../Makefile UCODE=$$i $(COMMONPREF)$@ );\
	done
	@for i in $(SUBPKGS) ; do \
		( cd $$i ; $(MAKE) $@ );\
	done

#-----------------------------------------------------------------------------
UCPKG	=	F3DEX2
UROOT	=	..
MAIN	=	gxmain.s

sinclude	locdefs

UCODE_TMP  =	$(UCODE:.NoN=_NoN)
UCODE_DEFS =	-DUCPKG_$(UCPKG) -DUCODE_$(UCODE_TMP:.Rej=_Rej) \
		-DOUT_$(OUTTYPE) $(LOCAL_DEFS) $(SAFE_MODE)
UCODE_OBJS =	gsp$(UCODE).$(OUTTYPE).o
UCODE_INCS =	-I$(UROOT) -I$(ROOT)/usr/include -I$(ROOT)/usr/include/PR \
		$(LOCAL_INCS)

VPATH =		$(UROOT):$(UROOT)/F3DEX2:$(UROOT)/F3DEX2.NoN:\
		:$(UROOT)/F3DEX2.Rej:$(UROOT)/F3DLX2.Rej:$(UROOT)/L3DEX2:\
		:$(UROOT)/S2DEX2:$(UROOT)/../graphics.S2DEX

COMMON_SRCS =	gxinit.s gxoutfifo.s gxoverlay.s gxdone.s gximm.s gxrdp.s \
		gxsubmod.s gxoutxbus.s gxloop.s
COMMON_HDRS =	gxdmem.h gxdmem_gstat.h gxdmem_lstat.h gxdmem_save.h \
		gxdmem_submod.h gxdmem_work.h gxdmem_task.h gxmacros.h gxregs.h

SRCS =		$(MAIN) $(COMMON_SRCS) $(LOCAL_SRCS)

HEADERS = 	$(COMMON_HDRS) $(LOCAL_HDRS)

LDIRT =		gsp$(UCODE).fifo gsp$(UCODE).xbus *.submod *.u *.dat *.lst \
		*.sym *.dbg *.elf *.tvd *~

RSPASM =	$(ROOT)/usr/sbin/rspasm

DOCS =		INSTALL.jp README.jp

PERL =          perl
BINHACK =	$(UROOT)/Tools/binHack.perl
MV =            mv

$(COMMONPREF)install $(COMMONPREF)exports:	$(_FORCE)
	$(INSTALL) -m 555 -F /usr/lib/PR \
		gsp$(UCODE).fifo.o gsp$(UCODE).xbus.o
	$(INSTALL) -m 444 -F /usr/src/PR/rspcode/graphics.F3DEX2/$(UCODE) \
		$(LOCAL_EXPT) locdefs

gsp$(UCODE).$(OUTTYPE).o:	$(SRCS) $(HEADERS) locdefs
	@echo '------- First  Pass (前方参照のための INDEX 作成) -------'
	$(RSPASM) \
		$(DEFINES) $(UCODE_DEFS) $(UCODE_INCS) -F -l \
		-o gsp$(UCODE).$(OUTTYPE) $(UROOT)/$(MAIN)
	@echo '\n------- Second Pass (アセンブル) -------'
	$(RSPASM) \
		$(DEFINES) $(UCODE_DEFS) $(UCODE_INCS) \
		-S gsp$(UCODE).$(OUTTYPE) \
		-o gsp$(UCODE).$(OUTTYPE) $(UROOT)/$(MAIN)
	@echo '\n------- Shrink DMEM -------'
	$(PERL) $(BINHACK) SEG_TOP_DMEM SEG_BTM_DMEM \
		gsp$(UCODE).$(OUTTYPE).dat \
		gsp$(UCODE).$(OUTTYPE).dbg > gsp$(UCODE).$(OUTTYPE).dat.tmp
	$(MV)   gsp$(UCODE).$(OUTTYPE).dat.tmp gsp$(UCODE).$(OUTTYPE).dat
	@echo '\n------- Make ELF object file -------'
	$(RSP2ELF) -p -r gsp$(UCODE).$(OUTTYPE)

#======== End of Makefile ========#