#!smake -k -J 4
####################
#     makefile     #
####################

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

APP =		pr
ROM =		rom
SPEC =		spec

include files

CODESEGMENT =	code.o
CODEOBJECTS =	$(CODEFILES:.c=.o) $(ASMCODEFILES:.s=.o) audio/audio.o
DATAOBJECTS =	$(DATAFILES:.c=.o) $(ASMDATAFILES:.s=.o)

OBJECTS =	$(CODESEGMENT) $(DATAOBJECTS)

#SOPTO   =  -fpr=32,-dpr=32,-arl=3,-chl=16,-chs=16,-inl,-inll=1,-ind=-1
#SOPT  =  -sopt,$(SOPTO) -framepointer -use_readwrite_const

#ifnmake urom

#OPTIMIZER =	-g -G 0 -mips2 $(SOPT)
OPTIMIZER =	-g -G 0 -mips2
LDIRT =		$(APP)
LCDEFS =	-DVTXCACHE32 -DF3DEX_GBI
LCINCS =	-I. -I/usr/include/PR 
LCOPTS =	-fullwarn -non_shared -signed -prototypes -Xcpluscomm
LDFLAGS =	 -u osReadHost -u osWriteHost $(MKDEPOPT) -nostdlib -L/usr/lib -m -lultra_d -mips2
MRFLAGS =

#else

#OPTIMIZER =	-O -G 0 -mips2 $(SOPT)
OPTIMIZER =	-O -G 0 -mips2
LDIRT =		$(APP)
LCDEFS =	-DVTXCACHE32 -DF3DEX_GBI -DROM_FLAG
LCINCS =	-I. -I$(ROOT)/usr/include/PR 
LCOPTS =	-fullwarn -non_shared -signed -prototypes -Xcpluscomm
LDFLAGS =	$(MKDEPOPT) -nostdlib -L/usr/lib -m -lultra_rom -mips2
MRFLAGS =	-DROM_FLAG -s 64 -f 0xff

#endif

default:	$(ROM)
urom   :	$(ROM)

include		$(COMMONRULES)

$(CODESEGMENT):	$(CODEOBJECTS)
		$(LD) -o $(CODESEGMENT) -r $(CODEOBJECTS) $(LDFLAGS) > linkmap

$(ROM) $(APP):	$(SPEC) $(OBJECTS) $(MAKEROM)
		$(MAKEROM) $(MRFLAGS) -m -o -r $(ROM) $(SPEC) > rommap

# DO NOT DELETE
