GNUmakefile 18.9 KB
include $(ROOT)/usr/include/make/PRdefs

COMMONPREF=viewer

FINAL      = YES
HI_RES     = YES
SA2        = YES
#SHOW_LP    = YES
#PC_TESTING = YES
#SHOW_BBID  = YES
#PARTNER   = YES
#PAK_COPY  = YES

APP        = viewer	
TARGETS    = rom
VIEWER_AES = viewer.aes
VIEWER_TIK = viewer.tik

LCINCS     = -I$(ROOT)/usr/include/PR -I$(ROOT)/usr/include -I. -I..
LCOPTS     = -G 0 -Wall -nostdinc -fno-pic -mcpu=4300 -mno-abicalls -DBBPLAYER -c 
LDFLAGS    = $(MKDEPOPT) -L$(ROOT)/usr/lib $(N64LIB)  --no-warn-mismatch -lgcc -lcrypto -lz
LDIRT      = $(APP) $(TARGETS) $(VIEWER_AES) $(VIEWER_TIK)

ifeq ($(FINAL), YES)
OPTIMIZER       = -Os 
LCDEFS		= -DNDEBUG -D_FINALROM -D_BBID_GUARD
N64LIB          = -lultra_rom
else
OPTIMIZER       = -g
LCDEFS          = -DDEBUG -D_BBID_GUARD 
N64LIB          = -lultra_d
endif
ifeq ($(PARTNER), YES)
LCDEFS += -D_PARTNER=1
endif
ifeq ($(HI_RES), YES)
LCDEFS += -DHI_RES=1
endif
ifeq ($(SHOW_BBID), YES)
LCDEFS += -DSHOW_BBID
endif
ifeq ($(SHOW_LP), YES)
LCDEFS += -DSHOW_LP
endif
ifeq ($(PC_TESTING), YES)
LCDEFS += -DPC_TESTING
endif
ifeq ($(SA2), YES)
LCDEFS += -DSA2
endif

ifdef LOGO_FADE
LCDEFS += -DLOGO_FADE
endif

HFILES =		\
	viewer.h	\
	status.h         \
        uilogic.h       \
	gfx.h		\
	gfxtex.h	\
	pagetop.h      \
	pagegame.h      \
	pagebind.h      \
	pagecontrol.h   \
	texrect.h       \
	font.h       \
	texture.h \
	gametex.h \
	gameticket.h \
	date.h \
	bbreg.h \
	gtime.h \
	vidreset.h
#	gzip.h \
#	pagecommon.h      \
#	pagedata.h      \
#	pageclub.h      \
#	cpak.h      \
#       shadowicon.h    

CODEFILES =		\
	controller.c	\
	gfx.c		\
	status.c	\
	uilogic.c \
	audrenderer.c \
	page.c	\
	pagetop.c	\
	pagegame.c	\
	pagebind.c	\
        pagecontrol.c   \
	texrect.c	\
	gfxstack.c	\
	gfxyield.c	\
	gfxstatic.c	\
	gfxdynamic.c	\
	font.c	\
	viewer.c \
	date.c \
	gtime.c \
	vidreset.c
#	unzip.c	\
#	pagecommon.c	\
#	pagedata.c	\
#	pageclub.c	\
#	cpak.c	\
#        shadowicon.c    

ifeq ($(PAK_COPY), YES)
LCDEFS += -DPAK_COPY

HFILES += \
	pagegpak.h   \
	pagecpak.h  

CODEFILES += \
        pagegpak.c   \
        pagecpak.c 

endif


texture/logo8.int: tool/bmp2int32 texture/logo8_32.bmp
	tool/bmp2int32 texture/logo8_32.bmp $@

texture/healthad4.int: tool/bmp2int32 texture/healthad_4.bmp
	tool/bmp2int32 texture/healthad_4.bmp $@

tool/bmp2int32: tool/bmp2int32.c
	$(HOST_CC) $< -Os -o $@	

pagetop.o: pagetop.c texture/b_game.rgb texture/b_game_h.rgb texture/b_gpak.rgb texture/b_gpak_h.rgb texture/b_cpak.rgb texture/b_cpak_h.rgb texture/b_tctl.rgb texture/b_tctl_h.rgb texture/bg.rgb texture/welcome.rgb texture/topbar.rgb texture/spacebar.rgb texture/spacebar-r1.rgb texture/spacebar-2.rgb texture/bottombar.rgb texture/a.rgb texture/b.rgb texture/z.rgb texture/snum.rgb texture/glyph.rgb texture/logo.rgb texture/logo8.int texture/link.rgb texture/mario.rgb texture/pica.rgb texture/bg_errorboard.rgb texture/peach.rgb texture/healthad4.int texture/binding_yes_h.rgb texture/binding_yes.rgb texture/binding_no_h.rgb texture/binding_no.rgb texture/inputpass.rgb texture/cancel.rgb texture/cancel_h.rgb texture/bind.rgb texture/newyear.rgb texture/birthday.rgb texture/up_arrow.rgb texture/down_arrow.rgb texture/cpaks.rgb texture/player.rgb texture/cpakrow.rgb texture/cpakrowh.rgb texture/cpakbg.rgb texture/dirty_star.rgb texture/b_man.rgb texture/b_man_h.rgb texture/source_card.rgb texture/desti_card.rgb texture/ique_home.rgb
	(tool/gzimg.pl RGBA 16 texture/bg.rgb texture/bg_gz.c gzTexBg gzTexBgSize; \
	tool/gzimg.pl RGBA 16 texture/newyear.rgb texture/newyear_gz.c gzTexNewyear gzTexNewyearSize; \
	tool/gzimg.pl RGBA 16 texture/b_game.rgb texture/b1_gz.c gzTexB1 gzTexB1Size; \
	tool/gzimg.pl RGBA 16 texture/b_man.rgb texture/b3_gz.c gzTexB3 gzTexB3Size; \
	tool/gzimg.pl RGBA 16 texture/b_tctl.rgb texture/b4_gz.c gzTexB4 gzTexB4Size; \
	tool/gzimg.pl RGBA 16 texture/b_cpak.rgb texture/b5_gz.c gzTexB5 gzTexB5Size; \
	tool/gzimg.pl RGBA 16 texture/b_gpak.rgb texture/b6_gz.c gzTexB6 gzTexB6Size; \
	tool/gzimg.pl RGBA 16 texture/b_game_h.rgb texture/hb1_gz.c gzTexHB1 gzTexHB1Size; \
	tool/gzimg.pl RGBA 16 texture/b_man_h.rgb texture/hb3_gz.c gzTexHB3 gzTexHB3Size; \
	tool/gzimg.pl RGBA 16 texture/b_tctl_h.rgb texture/hb4_gz.c gzTexHB4 gzTexHB4Size; \
	tool/gzimg.pl RGBA 16 texture/b_cpak_h.rgb texture/hb5_gz.c gzTexHB5 gzTexHB5Size; \
	tool/gzimg.pl RGBA 16 texture/b_gpak_h.rgb texture/hb6_gz.c gzTexHB6 gzTexHB6Size; \
	tool/gzimg.pl CI 8 texture/welcome.rgb texture/welcome_gz.c gzTexWelcome gzTexWelcomeSize; \
	tool/gzimg.pl CI 8 texture/birthday.rgb texture/birthday_gz.c gzTexBirthday gzTexBirthdaySize; \
	tool/gzimg.pl CI 8 texture/topbar.rgb texture/topbar_gz.c gzTexTopBar gzTexTopBarSize; \
	tool/gzimg.pl RGBA 16 texture/spacebar.rgb texture/spacebar_gz.c gzTexSpaceBar gzTexSpaceBarSize; \
	tool/gzimg.pl RGBA 16 texture/spacebar-r1.rgb texture/spacebar1_gz.c gzTexSpaceBar1 gzTexSpaceBar1Size; \
	tool/gzimg.pl RGBA 16 texture/spacebar-2.rgb texture/spacebar2_gz.c gzTexSpaceBar2 gzTexSpaceBar2Size; \
	tool/gzimg.pl CI 8 texture/bottombar.rgb texture/bottombar_gz.c gzTexBottomBar gzTexBottomBarSize; \
	tool/gzimg.pl RGBA 16 texture/a.rgb texture/a_gz.c gzTexA gzTexASize; \
	tool/gzimg.pl RGBA 16 texture/b.rgb texture/b_gz.c gzTexB gzTexBSize; \
	tool/gzimg.pl RGBA 16 texture/z.rgb texture/z_gz.c gzTexZ gzTexZSize; \
	tool/gzimg.pl IA 16 texture/snum.rgb texture/snum_gz.c gzTexSnum gzTexSnumSize; \
	tool/gzimg.pl RGBA 16 texture/glyph.rgb texture/glyph_gz.c gzTexZhglyph gzTexZhglyphSize; \
	tool/gzimg.pl CI 8 texture/link.rgb texture/char1_gz.c gzTexChar1 gzTexChar1Size; \
	tool/gzimg.pl CI 8 texture/mario.rgb texture/char2_gz.c gzTexChar2 gzTexChar2Size; \
	tool/gzimg.pl CI 8 texture/pica.rgb texture/char3_gz.c gzTexChar3 gzTexChar3Size; \
	tool/gzimg.pl CI 8 texture/peach.rgb texture/char4_gz.c gzTexChar4 gzTexChar4Size; \
	tool/gzimg.pl RGBA 16 texture/ique_home.rgb texture/ique_home_gz.c gzTexIQueHomeLogo gzTexIQueHomeLogoSize; \
	tool/gzraw.pl texture/logo8.int texture/logo8_gz.c gzTexLogo8 gzTexLogo8Size; \
	tool/gzraw.pl texture/healthad4.int texture/healthad4_gz.c gzHeathad4 gzTexHealthad4Size; \
	tool/gzimg.pl CI 8 texture/bg_errorboard.rgb texture/board_gz.c gzTexBoard gzTexBoardSize; \
	tool/gzimg.pl RGBA 16 texture/binding_yes.rgb texture/cyes_gz.c gzTexConfirmYes gzTexConfirmYesSize; \
	tool/gzimg.pl RGBA 16 texture/binding_yes_h.rgb texture/cyesh_gz.c gzTexConfirmYesH gzTexConfirmYesHSize; \
	tool/gzimg.pl RGBA 16 texture/binding_no.rgb texture/cno_gz.c gzTexConfirmNo gzTexConfirmNoSize; \
	tool/gzimg.pl RGBA 16 texture/binding_no_h.rgb texture/cnoh_gz.c gzTexConfirmNoH gzTexConfirmNoHSize; \
	tool/gzimg.pl RGBA 16 texture/inputpass.rgb texture/pcpwdin_gz.c gzTexPcPwdIn gzTexPcPwdInSize; \
	tool/gzimg.pl RGBA 16 texture/cancel.rgb texture/cancel_gz.c gzTexCancel gzTexCancelSize; \
	tool/gzimg.pl RGBA 16 texture/cancel_h.rgb texture/cancelh_gz.c gzTexCancelH gzTexCancelHSize; \
	tool/gzimg.pl RGBA 16 texture/bind.rgb texture/bind_gz.c gzTexBind gzTexBindSize; \
	tool/gzimg.pl RGBA 16 texture/up_arrow.rgb texture/uparrow_gz.c gzTexUpArrow gzTexUpArrowSize; \
	tool/gzimg.pl RGBA 16 texture/down_arrow.rgb texture/downarrow_gz.c gzTexDownArrow gzTexDownArrowSize; \
	tool/gzimg.pl RGBA 16 texture/cpaks.rgb texture/cpaks_gz.c gzTexCpak gzTexCpakSize; \
	tool/gzimg.pl RGBA 16 texture/player.rgb texture/player_gz.c gzTexPlayer gzTexPlayerSize; \
	tool/gzimg.pl RGBA 16 texture/cpakrow.rgb texture/cpakrow_gz.c gzTexCpakrow gzTexCpakrowSize; \
	tool/gzimg.pl RGBA 16 texture/cpakrowh.rgb texture/cpakrowh_gz.c gzTexCpakrowh gzTexCpakrowhSize; \
	tool/gzimg.pl RGBA 16 texture/cpakbg.rgb texture/cpakbg_gz.c gzTexCpakbg gzTexCpakbgSize; \
	tool/gzimg.pl RGBA 16 texture/source_card.rgb texture/scard_gz.c gzTexScard gzTexScardSize; \
	tool/gzimg.pl RGBA 16 texture/desti_card.rgb texture/dcard_gz.c gzTexDcard gzTexDcardSize; \
	tool/gzimg.pl IA 16 texture/dirty_star.rgb texture/dstar_gz.c gzTexDstar gzTexDstarSize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagetop.o pagetop.c;) 

ifdef 0
pagecommon.o: pagecommon.c texture/frame.rgb texture/frame_a.int texture/star.rgb texture/yes.rgba texture/no.rgba
	($(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texFrame texture/frame.rgb > texture/frame.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/frame.tex > texture/frame.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f I -s 4 -m texFrameAlpha texture/frame_a.int > texture/frame_a.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/frame_a.tex > texture/frame_a.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texStar texture/star.rgb > texture/star.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/star.tex > texture/star.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texB1 texture/b1.rgba > texture/b1.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/b1.tex > texture/b1.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texB2 texture/b2.rgba > texture/b2.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/b2.tex > texture/b2.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texB3 texture/b3.rgba > texture/b3.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/b3.tex > texture/b3.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texLight texture/light.rgb > texture/light.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/light.tex > texture/light.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f I -s 4 -m texLightAlpha texture/light_a.int > texture/light_a.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/light_a.tex > texture/light_a.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texYes texture/yes.rgba > texture/yes.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/yes.tex > texture/yes.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texNo texture/no.rgba > texture/no.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/no.tex > texture/no.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texLaunch texture/launch.rgba > texture/launch.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/launch.tex > texture/launch.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texBind texture/bind.rgba > texture/bind.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/bind.tex > texture/bind.c; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagecommon.o pagecommon.c;) 
endif

pagegame.o: pagegame.c texture/gamerow.rgb texture/gamerowh.rgb texture/red.rgb texture/yellow.rgb texture/card.rgb texture/depot.rgb texture/load.rgb texture/launch.rgb texture/recrypt.rgb texture/ztext.rgb texture/bnum.rgb texture/loadingmeter.rgb texture/loadingiconboundary.rgb texture/loadingmeterboundary.rgb texture/loadingadvise.rgb texture/isbn_glyph.rgb texture/ique_produce.rgb texture/publisher.rgb
	(tool/gzimg.pl RGBA 16 texture/gamerow.rgb texture/gamerow_gz.c gzTexGameRow gzTexGameRowSize; \
	tool/gzimg.pl RGBA 16 texture/gamerowh.rgb texture/gamerowh_gz.c gzTexGameRowH gzTexGameRowHSize; \
	tool/gzimg.pl RGBA 16 texture/red.rgb texture/red_gz.c gzTexRed gzTexRedSize; \
	tool/gzimg.pl RGBA 16 texture/yellow.rgb texture/yellow_gz.c gzTexYellow gzTexYellowSize; \
	tool/gzimg.pl RGBA 16 texture/card.rgb texture/card_gz.c gzTexCard gzTexCardSize; \
	tool/gzimg.pl RGBA 16 texture/depot.rgb texture/depot_gz.c gzTexDepot gzTexDepotSize; \
	tool/gzimg.pl RGBA 16 texture/load.rgb texture/load_gz.c gzTexLoad gzTexLoadSize; \
	tool/gzimg.pl RGBA 16 texture/recrypt.rgb texture/recrypt_gz.c gzTexRecrypt gzTexRecryptSize; \
	tool/gzimg.pl RGBA 16 texture/launch.rgb texture/launch_gz.c gzTexLaunch gzTexLaunchSize; \
	tool/gzimg.pl RGBA 16 texture/ztext.rgb texture/ztext_gz.c gzTexZtext gzTexZtextSize; \
	tool/gzimg.pl RGBA 16 texture/bnum.rgb texture/bnum_gz.c gzTexBnum gzTexBnumSize; \
	tool/gzimg.pl RGBA 16 texture/loadingmeter.rgb texture/loadmeter_gz.c gzTexLoadMeter gzTexLoadMeterSize; \
	tool/gzimg.pl RGBA 16 texture/loadingiconboundary.rgb texture/loadicon_gz.c gzTexLoadIcon gzTexLoadIconSize; \
	tool/gzimg.pl RGBA 16 texture/loadingmeterboundary.rgb texture/loadmeterb_gz.c gzTexLoadMeterb gzTexLoadMeterbSize; \
	tool/gzimg.pl RGBA 16 texture/loadingadvise.rgb texture/advice_gz.c gzTexAdvice gzTexAdviceSize; \
	tool/gzimg.pl IA 16 texture/isbn_glyph.rgb texture/isbn_gz.c gzTexIsbnGlyph gzTexIsbnGlyphSize; \
	tool/gzimg.pl IA 16 texture/ique_produce.rgb texture/producer_gz.c gzTexProducer gzTexProducerSize; \
	tool/gzimg.pl IA 16 texture/publisher.rgb texture/publisher_gz.c gzTexPublisher gzTexPublisherSize; \
	tool/gzimg.pl IA 16 texture/publishInfo01.rgb texture/pubinfo1_gz.c gzTexPubInfo1 gzTexPubInfo1Size; \
	tool/gzimg.pl IA 16 texture/publishInfo02.rgb texture/pubinfo2_gz.c gzTexPubInfo2 gzTexPubInfo2Size; \
	tool/gzimg.pl IA 16 texture/publishInfo03.rgb texture/pubinfo3_gz.c gzTexPubInfo3 gzTexPubInfo3Size; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagegame.o pagegame.c;) 

page.o: page.c texture/atext.rgb texture/btext.rgb texture/tlimit.rgb texture/plimit.rgb texture/remain.rgb texture/expire.rgb texture/cpgamebg.rgb texture/remain_time.rgb texture/delete_txt.rgb texture/copy_txt.rgb
	(tool/gzimg.pl RGBA 16 texture/atext.rgb texture/atext_gz.c gzTexAtext gzTexAtextSize; \
	tool/gzimg.pl RGBA 16 texture/btext.rgb texture/btext_gz.c gzTexBtext gzTexBtextSize; \
	tool/gzimg.pl IA 16 texture/tlimit.rgb texture/tlimit_gz.c gzTexTlimit gzTexTlimitSize; \
	tool/gzimg.pl IA 16 texture/plimit.rgb texture/plimit_gz.c gzTexPlimit gzTexPlimitSize; \
	tool/gzimg.pl IA 16 texture/remain.rgb texture/remain_gz.c gzTexRemain gzTexRemainSize; \
	tool/gzimg.pl IA 16 texture/expire.rgb texture/expire_gz.c gzTexExpire gzTexExpireSize; \
	tool/gzimg.pl RGBA 16 texture/gamebg.rgb texture/gamebg_gz.c gzTexGamebg gzTexGamebgSize; \
	tool/gzimg.pl RGBA 16 texture/cpgamebg.rgb texture/gamebg2_gz.c gzTexGamebg2 gzTexGamebg2Size; \
	tool/gzimg.pl RGBA 16 texture/remain_time.rgb texture/pcremain_gz.c gzTexPcRemain gzTexPcRemainSize; \
	tool/gzimg.pl RGBA 16 texture/delete_txt.rgb texture/delete_gz.c gzTexDelete gzTexDeleteSize; \
	tool/gzimg.pl RGBA 16 texture/copy_txt.rgb texture/copy_gz.c gzTexCopy gzTexCopySize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o page.o page.c;) 

pagebind.o: pagebind.c texture/save.rgb texture/controw.rgb texture/controwh.rgb texture/ztext_releasebinding.rgb texture/confirm_to_save.rgb 
	(tool/gzimg.pl RGBA 16 texture/save.rgb texture/save_gz.c gzTexSave gzTexSaveSize; \
	tool/gzimg.pl RGBA 16 texture/ztext_releasebinding.rgb texture/unbind_gz.c gzTexUnbind gzTexUnbindSize; \
	tool/gzimg.pl RGBA 16 texture/controw.rgb texture/controw_gz.c gzTexControw gzTexControwSize; \
	tool/gzimg.pl RGBA 16 texture/controwh.rgb texture/controwh_gz.c gzTexControwh gzTexControwhSize; \
	tool/gzimg.pl RGBA 16 texture/confirm_to_save.rgb texture/confirm_gz.c gzTexConfirm gzTexConfirmSize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagebind.o pagebind.c;) 

pagecontrol.o: pagecontrol.c texture/setclock.rgb texture/setexpire.rgb texture/setpass.rgb texture/setptime.rgb texture/t_ctl_t.rgb texture/bluebar.rgb texture/confirm_to_save_m.rgb texture/bluebar_h.rgb
	(tool/gzimg.pl RGBA 16 texture/setclock.rgb texture/pcclock_gz.c gzTexPcClock gzTexPcClockSize; \
	tool/gzimg.pl RGBA 16 texture/setexpire.rgb texture/pcexp_gz.c gzTexPcExp gzTexPcExpSize; \
	tool/gzimg.pl RGBA 16 texture/setpass.rgb texture/pcpwd_gz.c gzTexPcPwd gzTexPcPwdSize; \
	tool/gzimg.pl RGBA 16 texture/setptime.rgb texture/pclimit_gz.c gzTexPcLimit gzTexPcLimitSize; \
	tool/gzimg.pl RGBA 16 texture/t_ctl_t.rgb texture/pcadmin_gz.c gzTexPcAdmin gzTexPcAdminSize; \
	tool/gzimg.pl RGBA 16 texture/bluebar.rgb texture/pcbar_gz.c gzTexPcBar gzTexPcBarSize; \
	tool/gzimg.pl RGBA 16 texture/bluebar_h.rgb texture/pcbarh_gz.c gzTexPcBarH gzTexPcBarHSize; \
	tool/gzimg.pl RGBA 16 texture/confirm_to_save_m.rgb texture/pcconfirm_gz.c gzTexPcConfirm gzTexPcConfirmSize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagecontrol.o pagecontrol.c;) 

pagegpak.o: pagegpak.c texture/g_pak_t.rgb
	(tool/gzimg.pl RGBA 16 texture/g_pak_t.rgb texture/gpak_t_gz.c gzTexGpakTitle gzTexGpakTitleSize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagegpak.o pagegpak.c;) 

pagecpak.o: pagecpak.c texture/c_pak_t.rgb
	(tool/gzimg.pl RGBA 16 texture/c_pak_t.rgb texture/cpak_t_gz.c gzTexCpakTitle gzTexCpakTitleSize; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagecpak.o pagecpak.c;) 

ifdef 0
pagedata.o: pagedata.c texture/dgpak.rgba texture/igpak.rgba texture/ccpak.rgba texture/dcpak.rgba
	($(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texDGPak texture/dgpak.rgba > texture/dgpak.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/dgpak.tex > texture/dgpak.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texIGPak texture/igpak.rgba > texture/igpak.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/igpak.tex > texture/igpak.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texCCPak texture/ccpak.rgba > texture/ccpak.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/ccpak.tex > texture/ccpak.c; \
	$(ROOT)/usr/sbin/rgb2c -F -f RGBA -s 16 -m texDCPak texture/dcpak.rgba > texture/dcpak.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/dcpak.tex > texture/dcpak.c; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o pagedata.o pagedata.c;) 
endif

font.o: font.c texture/font_e.rgb texture/font_e.tbl
	($(ROOT)/usr/sbin/rgb2c -F -f I -s 8 -m texAscii texture/font_e.rgb > texture/font_e.tex; \
        sed -e s/"^static Gfx"/"\/\/static Gfx"/ texture/font_e.tex > texture/font_e.c; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o font.o font.c;)

ifeq ($(PARTNER), YES)
uilogic.o: uilogic.c texture/sm.rgba texture/sm.txt texture/wr.rgba texture/wr.txt texture/sf.rgba texture/sf.txt texture/zo.rgba texture/zo.txt 
	(tool/gen_desc.pl texture/sm.rgba texture/sm.txt texture/icon.desc; \
	tool/bin2c.pl texture/icon.desc texture/icon.h texIcon; \
	tool/gen_desc.pl texture/wr.rgba texture/wr.txt texture/icon1.desc; \
	tool/bin2c.pl texture/icon1.desc texture/icon1.h texIcon1; \
	tool/gen_desc.pl texture/sf.rgba texture/sf.txt texture/icon2.desc; \
	tool/bin2c.pl texture/icon2.desc texture/icon2.h texIcon2; \
	tool/gen_desc.pl texture/zo.rgba texture/zo.txt texture/icon3.desc; \
	tool/bin2c.pl texture/icon3.desc texture/icon3.h texIcon3; \
	$(CC) $(LCINCS) $(LCOPTS) $(LCDEFS) -Os -o uilogic.o uilogic.c;) 
endif

sound_table.h: 
	tool/bin2c.pl audio/sound.tbl sound_table.h soundTable
sound_bank.h: 
	tool/bin2c.pl audio/sound.ctl sound_bank.h soundBank

audrenderer.o: audrenderer.c sound_table.h sound_bank.h

CODEOBJECTS = $(CODEFILES:.c=.o)
CODESEGMENT = codesegment.o
DATAFILES   = texture.c gametex.c gameticket.c gfxcfb.c reserved.c
DATAOBJECTS = $(DATAFILES:.c=.o)

OBJECTS     = $(CODESEGMENT) $(DATAOBJECTS)

default: $(TARGETS)
ifneq ($(PARTNER), YES)
	../bundleBootapp $(TARGETS) $(VIEWER_AES) $(VIEWER_TIK)
endif

include $(COMMONRULES)

$(CODESEGMENT):	$(CODEOBJECTS)
		$(LD) -Os -o $(CODESEGMENT) -r $(CODEOBJECTS) $(LDFLAGS)

$(TARGETS) $(APP):      spec $(OBJECTS)
	$(MAKEROM) $(LCDEFS) -r $(TARGETS) spec -m > rom.map

install:	default

clobber clean: 
	rm -rf *.o $(LDIRT) texture/*.tex texture/*.c texture/*.h texture/*.desc texture/*.gz rom.map tool/bmp2int32 texture/logo8.int texture/healthad4.int