1###############################################################################
2# Makefile for nwc24demo
3#
4# Copyright 2006,2007 Nintendo. All rights reserved.
5#
6# These coded instructions, statements, and computer programs contain
7# proprietary information of Nintendo of America Inc. and/or Nintendo
8# Company Ltd., and are protected by Federal copyright law.  They may
9# not be disclosed to third parties or copied or duplicated in any form,
10# in whole or in part, without the prior written consent of Nintendo.
11#
12# $Log: makefile,v $
13# Revision 1.37  2007/11/19 02:30:50  inaba_kimitaka
14# The path specification of ntcompress was wrong, so it was corrected
15#
16# Revision 1.36  2007/11/13 23:27:11  nishimoto_takashi
17# The path to darchD.exe was wrong, so it was corrected
18#
19# Revision 1.35  2007/11/13 01:20:56  nishimoto_takashi
20# The letter demo was changed to specify GX_REPEAT during creation of TPL files
21# Revised the stationary and envelope images to make them easier to see
22#
23# Revision 1.34  2007/07/31 10:59:53  hatamoto_minoru
24# Added ChannelJump.wad's dependency relationships.
25# Changed such that the dvddata and viewer directories for ChannelJump are created.
26#
27# Revision 1.33  2007/07/30 04:52:39  nishimoto_takashi
28# Revised import target descriptions.
29#
30# Revision 1.32  2007/07/30 04:27:41  nishimoto_takashi
31# Changed the location at which ChannelJump.wad is created. Added make import.
32#
33# Revision 1.31  2007/07/30 01:20:05  nishimoto_takashi
34# Added the ChannelJump demo.
35#
36# Revision 1.30  2007/07/13 02:10:18  hirose_kazuki
37# Moved some of the demos.
38#
39# Revision 1.29  2007/07/11 09:42:32  yasu
40# Registration of intermediate files.
41# Support for make -s.
42#
43# Revision 1.28  2007/07/06 06:54:03  nishimoto_takashi
44# Specified the TexConv path to somewhere within the SDK.
45#
46# Revision 1.27  2007/07/06 02:34:30  nishimoto_takashi
47# In the Letter demo, made it possible to generate ARC files directly from TGA files.
48#
49# Revision 1.26  2007/07/05 07:38:33  nishimoto_takashi
50# Added the Letter demo.
51#
52# Revision 1.25  2007/06/23 12:22:05  seiki_masashi
53# Separated the shared source from the script-related demos.
54#
55# Revision 1.24  2007/06/18 01:26:54  hirose_kazuki
56# Added simple script demos.
57#
58# Revision 1.23  2007/06/14 00:45:40  hirose_kazuki
59# Added 'WiiNumber' demo.
60#
61# Revision 1.22  2007/06/07 06:06:39  adachi_hiroaki
62# Added a demo of the download feature.
63#
64# Revision 1.21  2007/05/14 11:37:17  hatamoto_minoru
65# Made "all" only dependent on "install" to support "make -j".
66#
67# Revision 1.20  2006/10/23 04:13:43  hirose_kazuki
68# Added 'Check' demo.
69#
70# Revision 1.19  2006/09/27 09:04:47  torigoe_nobutaka
71# Rearranged directory structure.
72#
73# Revision 1.18  2006/09/26 09:25:27  hirose_kazuki
74# Deleted InitMsgBox.
75#
76# Revision 1.17  2006/09/13 10:07:50  torigoe_nobutaka
77# Added FLViewer.
78#
79# Revision 1.16  2006/09/10 09:26:51  hirose_kazuki
80# Renamed MsgView -> MsgPrint.
81#
82# Revision 1.15  2006/09/09 06:01:26  hirose_kazuki
83# Changed all demos to use REX_LIBS to link.
84#
85# Revision 1.14  2006/09/05 10:56:42  yosizaki
86# Changed to use demos/share.
87#
88# Revision 1.13  2006/08/30 13:39:06  terui
89# Supported REXDEMO library once again.
90#
91# Revision 1.12  2006/08/30 10:27:53  terui
92# Added support for REXDEMO library.
93#
94# Revision 1.11  2006/08/28 08:52:13  torigoe_nobutaka
95# Added MessageViewer.
96#
97# Revision 1.10  2006/08/25 06:16:16  torigoe_nobutaka
98# Added MsgSearch.
99#
100# Revision 1.9  2006/08/25 04:23:45  terui
101# Made revisions in line with change of how the Schedule demo is created.
102#
103# Revision 1.8  2006/08/24 12:36:18  terui
104# Made revisions in line with change of how the Schedule demo is created.
105#
106# Revision 1.7  2006/08/09 02:53:06  hirose_kazuki
107# Changed to link net library.
108#
109# Revision 1.6  2006/08/08 06:17:26  yasu
110# Deleted REX_TITLEID.
111#
112# Revision 1.5  2006/07/31 04:32:29  yasu
113# Added TitleID specification.
114#
115# Revision 1.4  2006/07/18 08:53:30  terui
116# Added schedule demo.
117#
118# Revision 1.3  2006/07/09 13:10:10  yasu
119# PPC make tree connection completed.
120#
121# Revision 1.2  2006/07/01 07:12:20  hirose_kazuki
122# Changed to match sdd-pseg1 build system.
123#
124# Revision 1.1  2006/06/29 12:45:59  hirose_kazuki
125# Moved from another repository.
126#
127# Revision 1.1  2006/06/12 07:36:52  hirose
128# Initial check in.
129#
130#
131# $NoKeywords: $
132#
133###############################################################################
134
135# All modules have "setup" and "build" as targets.  System libraries
136# and demo programs also have an "install" target that copies the compiled
137# binaries to the binary tree (/$(ARCH_TARGET)).
138
139all:    install
140
141# Add Suffix for WAD File
142ifdef NDEBUG
143WADSUFFIX=.wad
144else
145WADSUFFIX=D.wad
146endif
147
148# commondefs must be included near the top so that all common variables
149# will be defined before their use.
150
151include $(REVOLUTION_EXT_ROOT)/build/buildtools/commondefs
152include $(REVOLUTION_EXT_ROOT)/build/demos/share/commondefs.demoshare
153
154# Module name should be set to the name of this subdirectory
155# DEMO = TRUE indicates that this module resides under the "demos" subtree.
156# The list of selectable paths can be found in modulerules.
157
158MODULENAME  =   nwc24demo
159DEMO        =   TRUE
160REX_NETDEMO =   TRUE
161
162# CSRCS lists all C files that should be built
163# The makefile determines which objects are linked into which binaries
164# based on the dependencies you fill in at the bottom of this file
165
166CSRCS       =   MsgList/MsgList.c           \
167                \
168                MsgPost/MsgPost.c           \
169                \
170                MsgPrint/MsgPrint.c         \
171                \
172                Schedule/Schedule.c         \
173                \
174                MsgSearch/MsgSearch.c       \
175                MsgSearch/PostTestMsg.c     \
176                \
177                MsgViewer/MsgViewer.c       \
178                MsgViewer/MsgViewerRender.c \
179                MsgViewer/MsgViewerUpdate.c \
180                \
181                FLViewer/FLViewer.c         \
182                FLViewer/FLViewerUpdate.c   \
183                FLViewer/FLViewerRender.c   \
184                \
185                Check/Check.c               \
186                \
187                Download/Download.c         \
188                \
189                WiiNumber/WiiNumber.c       \
190                \
191                Letter/Letter.c             \
192                \
193                ChannelJump/ChannelJump.c   \
194                ChannelJump/Src.c
195
196DATS		= Letter/my_letter.arc      \
197                  ChannelJump/Template.arc
198
199# BINNAMES lists all binaries that will be linked.  Note that no suffix is
200# required, as that will depend on whether this is a DEBUG build or not.
201# The final name of the binaries will be $(BINNAME)$(BINSUFFIX)
202
203BINNAMES    =   MsgList            \
204                MsgPost            \
205                MsgPrint           \
206                Schedule           \
207                MsgSearch          \
208                MsgViewer          \
209                FLViewer           \
210                Check              \
211                Download           \
212                WiiNumber          \
213                Letter             \
214                ChannelJump
215
216# defining a linker command file will have the build system generate it
217# automatically and include it on the linker invocation line
218
219LCF_FILE    = $(INC_ROOT)/revolution/eppc.$(ARCH_TARGET).lcf
220
221# Modulerules contains the rules that will use the above variables
222# and dependencies below to construct the binaries specified.
223
224include $(REVOLUTION_EXT_ROOT)/build/buildtools/modulerules
225include $(REVOLUTION_EXT_ROOT)/build/demos/share/modulerules.demoshare
226
227# Dependencies for the binaries listed in BINNAMES should come here
228# They are your typical makefile rule, with extra variables to ensure
229# that the names and paths match up.
230# $(FULLBIN_ROOT) is the location of the local bin directory
231# $(BINSUFFIX) depends on whether this is a debug build or not
232# $(REVOLUTION_LIBS) includes all the Revolution libraries.
233
234$(FULLBIN_ROOT)/MsgList$(BINSUFFIX):   MsgList/MsgList.o           \
235    $(REVOLUTION_LIBS) $(NWC24_LIB) $(REX_LIBS)
236
237$(FULLBIN_ROOT)/MsgPost$(BINSUFFIX):   MsgPost/MsgPost.o           \
238    $(REVOLUTION_LIBS) $(NWC24_LIB) $(REX_LIBS)
239
240$(FULLBIN_ROOT)/MsgPrint$(BINSUFFIX):  MsgPrint/MsgPrint.o         \
241    $(REVOLUTION_LIBS) $(NWC24_LIB) $(REX_LIBS)
242
243$(FULLBIN_ROOT)/MsgSearch$(BINSUFFIX): MsgSearch/MsgSearch.o       \
244                                       MsgSearch/PostTestMsg.o     \
245    $(REVOLUTION_LIBS) $(REX_LIBS)
246
247$(FULLBIN_ROOT)/Schedule$(BINSUFFIX):  Schedule/Schedule.o         \
248    $(REX_DEMOSHARE_OBJS) $(REVOLUTION_LIBS) $(REX_LIBS)
249
250$(FULLBIN_ROOT)/MsgViewer$(BINSUFFIX): MsgViewer/MsgViewer.o       \
251                                       MsgViewer/MsgViewerRender.o \
252                                       MsgViewer/MsgViewerUpdate.o \
253    $(REVOLUTION_LIBS) $(REX_LIBS)
254
255$(FULLBIN_ROOT)/FLViewer$(BINSUFFIX):  FLViewer/FLViewer.o         \
256                                       FLViewer/FLViewerUpdate.o   \
257                                       FLViewer/FLViewerRender.o   \
258    $(REVOLUTION_LIBS) $(REX_LIBS)
259
260$(FULLBIN_ROOT)/Check$(BINSUFFIX):     Check/Check.o         \
261    $(REVOLUTION_LIBS) $(REX_LIBS)
262
263$(FULLBIN_ROOT)/Download$(BINSUFFIX):  Download/Download.o         \
264    $(REVOLUTION_LIBS) $(REX_LIBS)
265
266$(FULLBIN_ROOT)/WiiNumber$(BINSUFFIX): WiiNumber/WiiNumber.o       \
267    $(REVOLUTION_LIBS) $(REX_LIBS)
268
269$(FULLBIN_ROOT)/Letter$(BINSUFFIX): Letter/Letter.o       \
270    $(FULLBINOBJ_ROOT)/Letter/my_letter.arc.o             \
271    $(REVOLUTION_LIBS) $(REX_LIBS)
272
273$(FULLBIN_ROOT)/ChannelJump$(BINSUFFIX): ChannelJump/ChannelJump.o       \
274    ChannelJump/Src.o                                    \
275    $(FULLBINOBJ_ROOT)/ChannelJump/Template.arc.o             \
276    $(REVOLUTION_LIBS) $(REX_LIBS)
277
278ifeq ($(wildcard $(ROOT)/X86/bin/makeWad.exe),$(ROOT)/X86/bin/makeWad.exe)
279
280dobuild: $(FULLBIN_ROOT)/ChannelJump$(WADSUFFIX)
281
282endif
283
284$(FULLBIN_ROOT)/ChannelJump$(WADSUFFIX): $(FULLBIN_ROOT)/ChannelJump$(BINSUFFIX)
285	makedol -f $(FULLBIN_ROOT)/ChannelJump$(BINSUFFIX) -d $(FULLBIN_ROOT)/ChannelJump$(DOLSUFFIX)
286	makeWad -n ChannelJump -l $(FULLBIN_ROOT)/ChannelJump$(DOLSUFFIX) -m data/ChannelJump/title.met -g 01 -gc 0001
287	install -d ./dvddata/viewer
288	mv ChannelJump.wad ./dvddata/viewer
289
290# Start Nmenu.elf and register ChannelJump.wad.
291import: $(FULLBIN_ROOT)/ChannelJump$(WADSUFFIX)
292	setndenv DvdRoot "$(REVOLUTION_EXT_ROOT)\build\demos\nwc24demo\dvddata"
293	ndrun $(REVOLUTION_SDK_ROOT)\RVL\bin\tools\Nmenu.elf -a -i ChannelJump.wad
294	setndenv DvdRoot "$(REVOLUTION_SDK_ROOT)\dvddata"
295
296
297############################################################
298##	For the Letter and ChannelJump demos
299############################################################
300CHJUMP_PATH	=	data/ChannelJump
301LETTER_PATH	=	data/Letter
302
303define CD_ARCPATH
304	$(if $(SILENT),,@echo "change dir... ")
305	cd $(LETTER_PATH)/
306endef
307
308LETTER_FILES		=	$(filter-out my_LetterS_b.tga,\
309				$(notdir $(wildcard $(LETTER_PATH)/img/*.tga)))
310
311LETTER_FILES_PATH	=	$(subst .tga,.tpl,\
312					$(addprefix img/,$(LETTER_FILES)))
313LETTER_FILES_FULLPATH	=	$(subst .tga,.tpl,\
314					$(addprefix $(LETTER_PATH)/img/,$(LETTER_FILES)))
315
316#
317# Register intermediate files
318#   make will automatically delete these files for us
319#   Also, this will no longer involve examining make's dependencies.
320#
321INTERMEDIATES		=	$(LETTER_PATH)/thumbnail_LZ.bin		\
322				$(LETTER_PATH)/letter_LZ.bin		\
323				$(LETTER_PATH)/thumbnail.arc		\
324				$(LETTER_PATH)/letter.arc		\
325				$(LETTER_FILES_FULLPATH)		\
326				$(LETTER_FILES_FULLPATH:.tpl=.tcs)	\
327				$(LETTER_PATH)/img/my_LetterS_b.tpl	\
328				$(LETTER_PATH)/img/my_LetterS_b.tcs	\
329				$(CHJUMP_PATH)/chjump.bin		\
330				$(CHJUMP_PATH)/Template.arc
331
332.INTERMEDIATE: $(INTERMEDIATES)
333
334#	Default target
335#	Generate archive -> Delete unnecessary files
336
337$(CHJUMP_PATH)/Template.arc: $(CHJUMP_PATH)/chjump.bin
338	cd $(CHJUMP_PATH); $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/darchD \
339	-c chjump.bin Template.arc
340
341$(CHJUMP_PATH)/chjump.bin:
342	cd $(CHJUMP_PATH); $(subst \,/,$(REVOLUTION_EXT_ROOT))/X86/bin/makeChjp \
343	-gc 0001 -d DMY_
344
345$(LETTER_PATH)/my_letter.arc: $(LETTER_PATH)/thumbnail_LZ.bin $(LETTER_PATH)/letter_LZ.bin
346	$(CD_ARCPATH) ; $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/darchD -c \
347                        thumbnail_LZ.bin letter_LZ.bin my_letter.arc
348
349clean:
350	rm -f $(LETTER_PATH)/my_letter.arc
351	rm -f $(CHJUMP_PATH)/Template.arc
352
353# Generate TPL files (delete TCS files)
354
355# Suppress unreported messages for "make -s"
356ifdef SILENT
357_SILENT_MODE_TEXCONV	= | sed -u -e '/^$$/d;/^total /d'
358endif
359
360$(LETTER_PATH)/img/%.tpl: $(LETTER_PATH)/img/%.tcs
361	$(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/TexConv $< $@ $(_SILENT_MODE_TEXCONV)
362
363# Generate TCS files
364# Specify GX_CLAMP in order to prevent wrapping in the textures.
365# (The reason for this is that GX_REPEAT is applied by default with TexConv.exe)
366
367$(LETTER_PATH)/img/%.tcs: $(LETTER_PATH)/img/%.tga
368	touch $@
369	echo path= data/Letter/img/ >> $@
370	echo file 0 = $(notdir $<) >> $@
371	echo image 0=0,0,RGB5A3, GX_CLAMP, GX_CLAMP >> $@
372	echo texture 0=0,x >> $@
373
374# Generate archive (delete TPL files)
375
376$(LETTER_PATH)/thumbnail.arc: $(LETTER_PATH)/img/my_LetterS_b.tpl
377	$(CD_ARCPATH) ; $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/darchD -c \
378                             img/my_LetterS_b.tpl thumbnail.arc
379
380$(LETTER_PATH)/letter.arc: $(LETTER_FILES_FULLPATH)
381	$(CD_ARCPATH) ; $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/darchD -c \
382                             $(LETTER_FILES_PATH) letter.arc
383
384# LZ77 compression
385
386$(LETTER_PATH)/thumbnail_LZ.bin: $(LETTER_PATH)/thumbnail.arc
387	$(CD_ARCPATH) ; $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/ntcompress \
388                             -l -A4 -o thumbnail_LZ.bin thumbnail.arc
389
390$(LETTER_PATH)/letter_LZ.bin: $(LETTER_PATH)/letter.arc
391	$(CD_ARCPATH) ; $(subst \,/,$(REVOLUTION_SDK_ROOT))/X86/bin/ntcompress \
392                             -l -A4 -o letter_LZ.bin letter.arc
393
394#======== End of makefile ========#
395