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