1#! make -f
2#----------------------------------------------------------------------------
3
4#----------------------------------------------------------------------------
5# usage:
6#
7# make import
8#  This creates a single WAD file that uses $(TARGET_BANNER) and then imports it
9#
10# make checkicon
11#  To check for icon processing lag, this creates and imports 47 WAD files that use $(TARGET_BANNER)
12#
13#
14# make checkbanner
15#  To check for banner processing lag, this creates 1 WAD file that uses $(TARGET_BANNER) and 46 WAD files that use icons for testing and then imports those files
16#
17#
18
19
20
21#----------------------------------------------------------------------------
22# CONFIG
23#
24
25# Define the path to the Icon Banner Tools package as an environment variable.
26# When no setting is specified, it will be set to be the same as $(REVOLUTION_SDK_ROOT).
27RVL_ICON_BANNER_TOOL_DIR	?= $(REVOLUTION_SDK_ROOT)
28
29# Current directory name
30CURRENT_DIR = $(shell basename $(shell pwd))
31
32# Basic information about channel applications.
33# This is used when creating WAD files with 'make import'.
34GAME_CODE	:= ICBN
35# This is used when creating WAD files with 'make checkicon' or 'make checkbanner'
36GAME_CODE_HEADER	:= Cs
37GAME_CODE_HEADER_HEX	:= 4373
38
39COMPANY_CODE		:= 01
40TITLE_VERSION		:= 0
41
42# DOL filenames that will be the content of the channel application and the channel's WAD filenames
43TARGET_DOL		:= simple.dol
44TARGET_BANNER		:= opening.bnr
45
46# Icon banner, title code, and DOL filename for the channel to use for testing
47CHECKCHANNEL_BANNER	:= checkchannel.bnr
48CHECKCHANNEL_CODE_HEADER	:= $(GAME_CODE_HEADER)
49CHECKCHANNEL_DOL		:= simple.dol
50
51# Path to the folder for holding all the various output files
52CHAN_BIN_DIR	:= bin
53
54
55# Required makeWad options for displaying channel applications with WiiMenu3CSViewer.
56# This is not required when checking the display on the Wii Menu.
57# When creating a WAD file for a master submission, ALWAYS COMMENT OUT THIS OPTION so that it is not set!!!
58#
59# CSVIEWER_SPECIAL_OPT	:= -E 0000
60
61# Path to Nmenu.elf
62NMENU			= $(RVL_ICON_BANNER_TOOL_DIR)/RVL/bin/tools/Nmenu.elf
63# Path to makeWad
64MAKEWAD			= $(RVL_ICON_BANNER_TOOL_DIR)/X86/bin/makeWad.exe
65
66
67# Path to the viewer folder(s) below DVDROOT when running Nmenu.elf.
68# Nmenu.elf references and automatically imports the channel application.
69DVD_VIEWER_DIR	= $(RVL_ICON_BANNER_TOOL_DIR)/dvddata/viewer
70
71
72#----------------------------------------------------------------------------
73# NW4R commondefs
74#
75
76include	$(NW4R_ROOT)/Library/build/buildtools/commondefs
77
78
79#----------------------------------------------------------------------------
80# Create a binary file and import a single WAD file
81#
82import:
83	$(MAKE) sampleelf
84	$(MAKE) wad1 GAME_CODE=$(GAME_CODE) TARGET_WAD=$(GAME_CODE).wad
85	ndrun $(NMENU) -d=$(RVL_ICON_BANNER_TOOL_DIR)/build/demos/iconbanner/$(CURRENT_DIR)/nmenu.ddf -a -i $(GAME_CODE).wad
86
87#----------------------------------------------------------------------------
88# Create a binary file and import 47 WAD files
89#
90
91checkicon:
92	$(MAKE) sampleelf
93	$(MAKE) import47
94
95#----------------------------------------------------------------------------
96# Create a binary file and import 1 WAD file and 46 channels for testing
97#
98
99checkbanner:
100	$(MAKE) checkelf
101	$(MAKE) import46
102
103
104#----------------------------------------------------------------------------
105# Create the ELF file of the main channel application
106#
107
108sampleelf:
109	$(MAKE) -C main
110
111#----------------------------------------------------------------------------
112# Create the ELF file for the 'check' channel
113#
114
115checkelf:
116	$(MAKE) -C main
117
118
119
120#----------------------------------------------------------------------------
121# Create the WAD file
122#
123
124wad1:
125	$(MAKEWAD) -n $(subst .wad,,$(TARGET_WAD)) -l $(CHAN_BIN_DIR)/$(TARGET_DOL) -m $(TARGET_BANNER) -g $(COMPANY_CODE) -gc $(GAME_CODE) -I $(TITLE_VERSION) $(CSVIEWER_SPECIAL_OPT)
126	$(MV) $(TARGET_WAD) $(CHAN_BIN_DIR)
127	$(MKDIRP) $(DVD_VIEWER_DIR)
128	$(CP) $(CHAN_BIN_DIR)/$(TARGET_WAD) $(DVD_VIEWER_DIR)
129
130
131
132GAME_CODE_NUM_LIST47= \
133		01 02 03 04 05 06 07 08 09 10 \
134		11 12 13 14 15 16 17 18 19 20 \
135		21 22 23 24 25 26 27 28 29 30 \
136		31 32 33 34 35 36 37 38 39 40 \
137		41 42 43 44 45 46 47
138
139
140#----------------------------------------------------------------------------
141# Create 46 WAD files for channels used for testing
142#
143
144makecheckchannel1:
145	$(MAKEWAD) -n $(subst .wad,,$(TARGET_WAD)) -l $(CHAN_BIN_DIR)/$(CHECKCHANNEL_DOL) -m $(CHECKCHANNEL_BANNER) -g $(COMPANY_CODE) -gc $(GAME_CODE) -I $(TITLE_VERSION) $(CSVIEWER_SPECIAL_OPT)
146	$(MV) $(TARGET_WAD) $(CHAN_BIN_DIR)
147	$(MKDIRP) $(DVD_VIEWER_DIR)
148	$(CP) $(CHAN_BIN_DIR)/$(TARGET_WAD) $(DVD_VIEWER_DIR)
149
150
151makecheckchannel47:
152	$(foreach gc,$(GAME_CODE_NUM_LIST47),make makecheckchannel1 GAME_CODE=0x$(GAME_CODE_HEADER_HEX)`expr 30 + $(gc) / 10``expr 30 + $(gc) % 10` TARGET_WAD=$(CHECKCHANNEL_CODE_HEADER)$(gc).wad &&) true
153
154
155#----------------------------------------------------------------------------
156# Create 47 WAD files
157# Cs01 - Cs47
158
159wad47:
160	$(foreach gc,$(GAME_CODE_NUM_LIST47),make wad1 GAME_CODE=0x$(GAME_CODE_HEADER_HEX)`expr 30 + $(gc) / 10``expr 30 + $(gc) % 10` TARGET_WAD=$(GAME_CODE_HEADER)$(gc).wad &&) true
161
162
163
164#----------------------------------------------------------------------------
165# Import the channel application
166#
167
168# Import 47 channel applications (to check for icon processing lag)
169import47: wad47
170	ndrun $(NMENU) -d=$(RVL_ICON_BANNER_TOOL_DIR)/build/demos/iconbanner/$(CURRENT_DIR)/nmenu.ddf -a $(foreach gc,$(GAME_CODE_NUM_LIST47),-i $(GAME_CODE_HEADER)$(gc).wad)
171
172# Import 1 channel application and 46 sample channels.
173#(Used to check whether there is processing lag when expanding the banner)
174# The first page has channels such as the Mii Channel, so a channel in the middle (the 24th) is overwritten for checking.
175#
176import46: makecheckchannel47
177	$(MAKE) wad1 GAME_CODE=0x$(GAME_CODE_HEADER_HEX)3234 TARGET_WAD=$(CHECKCHANNEL_CODE_HEADER)24.wad
178	ndrun $(NMENU) -d=$(RVL_ICON_BANNER_TOOL_DIR)/build/demos/iconbanner/$(CURRENT_DIR)/nmenu.ddf -a $(foreach gc,$(GAME_CODE_NUM_LIST47),-i $(CHECKCHANNEL_CODE_HEADER)$(gc).wad)
179
180#----------------------------------------------------------------------------
181# Erases all binary files
182#
183clean: clean_all
184clean_all:
185	$(RM) $(CHAN_BIN_DIR)/*
186	$(MAKE) -C main clean
187ifneq ($(findstring iconCs.arc,$(CHAN_CONTENTS)),)
188	$(MAKE) -C iconCs clean
189endif
190ifneq ($(findstring bannerCs.arc,$(CHAN_CONTENTS)),)
191	$(MAKE) -C bannerCs clean
192endif
193
194
195#----------------------------------------------------------------------------
196# NW4R modulerules
197#
198
199include	$(NW4R_ROOT)/Library/build/buildtools/modulerules
200
201
202#===== End of Makefile =====
203