1#! make -f 2#---------------------------------------------------------------------------- 3# Project: TwlSDK - WM - demo - wireless-all 4# File: Makefile 5# 6# Copyright 2006-2008 Nintendo. All rights reserved. 7# 8# These coded instructions, statements, and computer programs contain 9# proprietary information of Nintendo of America Inc. and/or Nintendo 10# Company Ltd., and are protected by Federal copyright law. They may 11# not be disclosed to third parties or copied or duplicated in any form, 12# in whole or in part, without the prior written consent of Nintendo. 13# 14# $Date:: 2008-12-24#$ 15# $Rev: 9728 $ 16# $Author: okubata_ryoma $ 17#---------------------------------------------------------------------------- 18 19SUBDIRS = 20SUBMAKES = Makefile.icon 21 22 23#---------------------------------------------------------------------------- 24# The source files used with this program are shown below. 25#---------------------------------------------------------------------------- 26# This only runs on NITRO 27TARGET_PLATFORM := NITRO 28 29SRCDIR = ./src 30INCDIR = ./include 31 32# Common parent processes 33SRCS = main.c \ 34 common.c \ 35 test.c 36 37# Wireless driver processes (simple WH wrapper) 38SRCS += wh_measure.c \ 39 wh_download.c \ 40 wh_datasharing.c 41 42# Uses the WH (wireless sample module) 43WH_DIR = $(ROOT)/build/demos/wireless_shared/wh 44LINCLUDES += $(WH_DIR) 45SRCS += $(WH_DIR)/wh.c 46 47# Uses the MBP (DS Download Play sample module) 48MBP_DIR = $(ROOT)/build/demos/wireless_shared/mbp 49LINCLUDES += $(MBP_DIR) 50SRCS += $(MBP_DIR)/mbp.c 51 52# Uses the WFS (wireless file system sample module) 53WFS_DIR = $(ROOT)/build/demos/wireless_shared/wfs 54LINCLUDES += $(WFS_DIR)/include 55SRCS += $(WFS_DIR)/src/wfs_common.c 56 57#---------------------------------------------------------------------------- 58# The resources used when building this program are shown below 59#---------------------------------------------------------------------------- 60 61# The directory that stores the data to convert from .dat -> .o format with bin2obj.exe 62DATA_DIR = ./data/image 63 64# The wireless link strength icon 65WLICON_DIR = $(ROOT)/data/wl_icons 66WLICON_OBJS = $(patsubst $(WLICON_DIR)/wireless_strength_level_%_b.bmp,$(OBJDIR)/linkimg%.o,$(WLICON_BMP)) 67EXT_OBJS += $(WLICON_OBJS) 68 69# BG character for ASCII text display 70BGCHAR_OBJS = $(patsubst $(DATA_DIR)/%.dat,$(OBJDIR)/%.o,$(wildcard $(DATA_DIR)/*.dat)) 71EXT_OBJS += $(BGCHAR_OBJS) 72 73 74#---------------------------------------------------------------------------- 75# The general application settings are shown below 76#---------------------------------------------------------------------------- 77 78TARGET_NEF = main.nef 79TARGET_BIN = main.srl 80TWL_MAKEROM = TRUE 81MAKEROM_ROMROOT = ./data/rom 82MAKEROM_ROMFILES = * 83 84# To compress each segment of a program, enable this flag. 85# With a reduced binary size on the CARD-ROM, compressed segments reduce load times via wireless transfers or CARD-ROM but requires some CPU time to extract their contents at runtime. 86# 87# 88 89TWL_COMPRESS = TRUE 90 91# You must always enable TWL_DIGEST for security when using overlays as wireless download children. 92# 93 94TWL_DIGEST = TRUE 95 96 97#---------------------------------------------------------------------------- 98 99 100include $(TWLSDK_ROOT)/build/buildtools/commondefs 101 102do-build: $(TARGETS) 103 104#---------------------------------------------------------------------------- 105# Special settings for the clone boot parent are shown below 106#---------------------------------------------------------------------------- 107 108# Specifies the link settings template for clone booting in order to place the .parent section, which is specific to parent devices and used for security purposes 109# 110 111ifeq ($(TARGET_PLATFORM),TWL) 112LCFILE_TEMPLATE = $(TWL_SPECDIR)/ARM9-TS-cloneboot-C.lcf.template 113else 114LCFILE_TEMPLATE = $(NITRO_SPECDIR)/ARM9-TS-cloneboot-C.lcf.template 115endif 116 117# The contents of the .parent section are not sent to the child machine in DS Download Play. 118# Placing essential and parent-specific functions in this section makes it impossible to duplicate the parent device from intercepted transmission data. 119# 120# When positioning the code, please note the following: 121# -Do not include anything other than the .text/.rodata section 122# -Include important process required only by the parent 123# 124# Code in the .parent section is arranged as follows. 125# 126# #include <nitro/parent_begin.h> 127# 128# void ForParentOnly(void) 129# { 130# /* Processing exclusive to the parent goes here */ 131# } 132# 133# #include <nitro/parent_end.h> 134# 135# In this sample demo, all of the functions for DS Download Play are placed in the .parent section. 136# See the source code for details. 137 138 139# Official system call libraries, distributed for every retail application, are specified here. 140# 141# In this sample, a copy of the version included in the SDK (lib/ARM9-TS/etc/libsyscall.a) has been provisionally placed in this directory in advance. 142# 143# When creating an application based on this demo, overwrite these provisional system calls with the libsyscal.a provided by Nintendo. 144# 145# 146 147LIBSYSCALL = ./etc/libsyscall.a 148LIBSYSCALL_CHILD = ./etc/libsyscall_child.bin 149 150 151#---------------------------------------------------------------------------- 152# Below is the signature procedure to run the application on the production model 153#---------------------------------------------------------------------------- 154 155# The following a is rough outline of signature procedure. 156# For details, see "DS Download Play." 157# (/docs/TechnicalNotes/AboutMultiBoot.pdf) 158# 159# (0) If clone boot, use the emuchild command to prepare the program to send. 160# If not, use main.srl without modification. 161# In this makefile, the prepared program is bin/sign.srl. 162# 163# (1) To get the signature code, send tmp/sign.srl, which was prepared in Step 0, to the server. 164# You must do this by hand using your browser. 165# In this makefile, the obtained signature code is bin/sign.sgn. 166# 167# (2) Use the attachsign command to combine main.srl and bin/sign.sgn, obtained in step (1), and create the final program. 168# 169# In this makefile, the product is main_with_sign.srl. 170# 171 172# When clone booting, the program will send a program modified using emuchild, instead of itself, to the server. This differs slightly from an ordinary DS Download Play program. 173# 174 175presign: 176 $(EMUCHILD) \ 177 bin/$(TWL_BUILDTYPE)/$(TARGET_BIN) \ 178 $(LIBSYSCALL_CHILD) \ 179 bin/sign.srl 180 181# The procedure to include the obtained signature code in the binary is the same in both clone boot and normal operation 182postsign: 183 $(ATTACHSIGN) \ 184 bin/$(TWL_BUILDTYPE)/$(TARGET_BIN) \ 185 bin/sign.sgn \ 186 main_with_sign.srl 187 188#---------------------------------------------------------------------------- 189 190include $(TWLSDK_ROOT)/build/buildtools/modulerules 191 192# All binary data is linked as a constant array 193$(OBJDIR)/%.o : $(DATA_DIR)/%.dat 194 $(BIN2OBJ) --compatible $< $@ >/dev/null 195 196 197#===== End of Makefile ===== 198