1#============================================================================ 2# Global module make rules for RevolutionNET build system 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: modulerules.rex,v $ 13# Revision 1.42 2007/06/15 05:45:52 hirose_kazuki 14# Added build support for NWC24 scripts 15# 16# Revision 1.41 2007/05/23 02:30:01 adachi_hiroaki 17# Revised the makeo path 18# 19# Revision 1.40 2007/05/14 11:38:58 hatamoto_minoru 20# Made "rex-install" dependent on "build" to support "make -j". 21# 22# Revision 1.39 2006/12/07 08:50:40 yasu 23# Dealt with issue wherein a build error would occur if the entries contained in MODULENAME and BINNAMES matched. 24# 25# Revision 1.38 2006/10/04 09:16:08 yasu 26# Error output handling in rm 27# 28# Revision 1.37 2006/10/04 08:33:25 yasu 29# Corrected the error with the ddf generation process when apploader does not exist 30# 31# Revision 1.36 2006/10/04 08:08:26 yasu 32# Revised the REX_TOOL build rules. 33# 34# Revision 1.35 2006/09/28 10:02:04 yasu 35# Revised so that apploader will be generated as well. 36# 37# Revision 1.34 2006/09/19 12:39:25 terui 38# Made changes so that -DREVOEX_PACKAGE switch will be added at REX_PACKAGE_BUILD. 39# 40# Revision 1.33 2006/09/19 06:29:56 yasu 41# Set noFW version 42# 43# Revision 1.32 2006/09/15 02:32:26 yasu 44# - Revised the DIP_INET6* flag process 45# 46# Revision 1.31 2006/09/15 02:22:09 yasu 47# - Added DIP_INET6* flag. 48# 49# Revision 1.30 2006/09/14 09:23:31 yasu 50# Added support for IP4 switch flag. 51# 52# Revision 1.29 2006/08/28 11:37:24 yasu 53# Made it so that an environment variable can be specified for REX_DVDROOT. 54# This allows pathname specifications such as ${REVOLUTION_SDK_ROOT}/dvddata. 55# 56# Revision 1.28 2006/08/28 11:23:03 yasu 57# Revised REX_DVDROOT setting. 58# 59# Revision 1.27 2006/08/25 14:49:53 yasu 60# Made additions related to REX_TOOL. 61# 62# Revision 1.26 2006/08/24 04:29:43 adachi_hiroaki 63# Added settings for building tools using NW4R. 64# 65# Revision 1.25 2006/08/22 10:00:12 yasu 66# Added display for checking error generating directories. 67# 68# Revision 1.24 2006/08/15 04:37:08 yasu 69# Hide the sed command that edits depend 70# 71# Revision 1.23 2006/08/11 10:39:05 yasu 72# Made it possible to compile files in different directories 73# 74# Revision 1.22 2006/08/11 08:41:26 yasu 75# Adjusted warning level 76# 77# Revision 1.21 2006/08/09 13:31:06 yasu 78# Support for REX_DVDROOT 79# 80# Revision 1.20 2006/08/08 02:48:34 seiki_masashi 81# Support for binary data linking 82# 83# Revision 1.19 2006/07/31 07:53:36 yasu 84# ddf file not installed if TITLEID is 0 85# 86# Revision 1.18 2006/07/31 06:12:00 yasu 87# Moved overwrite of do-setup command to commondefs. 88# 89# Revision 1.17 2006/07/31 04:24:56 yasu 90# Added ddf for switching firmware. 91# 92# Revision 1.16 2006/07/26 00:13:44 yasu 93# Handled the fact that an ls-related warning is output if there is no 94# lib/ARCH directory when executing make install defined by RVL_SDK. 95# 96# Revision 1.15 2006/07/24 05:18:27 terui 97# Corrected a problem where "@" was applied to the wrong place within the operating details of do-setup. 98# 99# Revision 1.14 2006/07/24 05:14:27 terui 100# Changed operating details of do-setup. 101# 102# Revision 1.13 2006/07/22 14:50:10 yasu 103# Stop echo back during setup. 104# 105# Revision 1.12 2006/07/22 13:09:42 yasu 106# Revised the method of creating a directory during setup. 107# This allows the use of make -B 108# 109# Revision 1.11 2006/07/21 06:32:46 yasu 110# Embed installer creation feature 111# 112# Revision 1.10 2006/07/20 06:20:47 yasu 113# Adjusted clean/clobber processing. 114# 115# Revision 1.9 2006/07/18 12:50:38 yasu 116# Set delete files when executing make clean. 117# 118# Revision 1.8 2006/07/18 11:45:54 yasu 119# Added MYCCFLAGS. 120# 121# Revision 1.7 2006/07/10 04:08:02 yasu 122# Added distclean. 123# 124# Revision 1.6 2006/07/09 13:10:10 yasu 125# PPC-side make tree connection complete 126# 127# Revision 1.5 2006/07/09 11:26:02 yasu 128# moving process intermediate save 2 129# 130# Revision 1.4 2006/07/09 08:16:10 yasu 131# moving process intermediate save 1 132# 133# Revision 1.3 2006/06/22 02:35:31 terui 134# Changed the make directory command from $(MKDIR) to mkdir -p 135# 136# Revision 1.2 2006/06/17 07:19:53 seiki_masashi 137# Changed so that C code in $(SRCDIR) can be built 138# 139# Revision 1.1 2006/05/30 07:09:57 terui 140# Initial upload. 141# 142# 143# $NoKeywords: $ 144# 145#============================================================================ 146 147ifeq (TRUE,$(LIB)) 148$(FULLBIN_ROOT)/$(MODULENAME)$(BINSUFFIX): $(CSRCS:.c=.o) $(addsuffix .o,$(DATS)) $(REVOLUTION_LIBS) $(REX_LIBS) 149endif 150 151OBJECTS += $(addprefix $(FULLBINOBJ_ROOT)/,$(addsuffix .o,$(DATS))) 152CCFLAGS_WARNING ?= $(WARNLV_SDKINC) 153CCFLAGS += $(CCFLAGS_WARNING) $(MYCCFLAGS) 154 155ifeq (TRUE,$(REX_IP_INET4_ONLY)) 156CCFLAGS += -DIP_INET4_ONLY 157else 158CCFLAGS += -DIP_INET6 159endif 160 161ifeq (TRUE,$(REX_IP_INET6_IGNORED)) 162CCFLAGS += -DIP_INET6_IGNORED 163endif 164 165ifeq (TRUE,$(REX_PACKAGE_BUILD)) 166CCFLAGS += -DREVOEX_PACKAGE 167endif 168 169# 170# make *.o 171# 172define MAKEDIRS 173 @if [ ! -d $(@D) ] ; then \ 174 mkdir -p $(@D) ; \ 175 fi 176 @if [ ! -d $(dir $(FULLDEP_ROOT)/$*) ] ; then \ 177 mkdir -p $(dir $(FULLDEP_ROOT)/$*) ; \ 178 fi 179 @echo "" 180endef 181 182define C_COMPILE 183 @echo ">> $< --> $(BINOBJ_ROOT)/$(subst $(FULLBINOBJ_ROOT)/,,$@)" 184 $(CC) $(CCFLAGS) $(INCLUDES) $(COMPILE) $< \ 185 -o $(subst $(FULLBINOBJ_ROOT)/,$(BINOBJ_ROOT)/,$@) -gccdep -MD 186 @sed -f "$(REVOLUTION_EXT_ROOT)/build/buildtools/eppccleandepend.sed" $(@:.o=.d) > $(DEP_ROOT)/$*.d && \ 187 rm -f $(@:.o=.d) 188endef 189 190define DAT_COMPILE 191 @echo ">> $< --> $(BINOBJ_ROOT)/$(subst $(FULLBINOBJ_ROOT)/,,$@)" 192 $(ROOT)/X86/bin/$(MAKEO) $(MAKEO_FLAGS) -b $(subst .,_,$(notdir $<))_begin -e $(subst .,_,$(notdir $<))_end -o $@ $< 193endef 194 195# 196SRCDIR ?= src 197 198$(FULLBINOBJ_ROOT)/%.o: $(SRCDIR)/%.c 199 $(MAKEDIRS) 200 $(C_COMPILE) 201 202$(FULLBINOBJ_ROOT)/%.o: $(REX_LOCAL_DATDIR)/% 203 $(MAKEDIRS) 204 $(DAT_COMPILE) 205 206$(FULLBINOBJ_ROOT)/%.bkws: $(SRCDIR)/%.kws 207 $(NWC24CC) $(<) -o $(@) 208 209 210# 211# directories 212# 213ifeq ($(REX_TOOL), TRUE) 214PROJ_ROOT = $(REX_DIR)/build/tools 215REX_INSTALL_SUBDIR = bin/tools 216endif 217ifeq ($(REX_DEMO), TRUE) 218PROJ_ROOT = $(REX_DIR)/build/demos 219REX_INSTALL_SUBDIR = bin/demos/$(MODULENAME) 220endif 221 222# 223# make setup 224# 225do-setup: 226 @$(ECHO_CURDIR) 227 @$(MKDIRP) $(REX_INSTALL_DIR)/$(ARCH_TARGET)/include \ 228 $(REX_INSTALL_DIR)/$(ARCH_TARGET)/lib \ 229 $(REX_INSTALL_DIR)/$(ARCH_TARGET)/bin \ 230 $(MODULE_ROOT)/obj/$(ARCH_TARGET)/DEBUG \ 231 $(MODULE_ROOT)/obj/$(ARCH_TARGET)/NDEBUG \ 232 $(MODULE_ROOT)/depend/$(ARCH_TARGET)/DEBUG \ 233 $(MODULE_ROOT)/depend/$(ARCH_TARGET)/NDEBUG \ 234 $(MODULE_ROOT)/lib lib/$(ARCH_TARGET) \ 235 $(if $(DEMO)$(TEST)$(REX_TOOL),$(MODULE_ROOT)/bin bin/$(ARCH_TARGET)) 236 237# 238# make dobuild (for DDF) 239# 240TARGET_DDFS = $(TARGET_BINS:.elf=.ddf) 241TARGET_APPLOADER_DDF = $(REX_BOOTDIR)/apploader.$(REX_TITLEID).ddf 242 243ifneq ($(REX_TITLEID)$(REX_DVDROOT),0) 244dobuild: $(TARGET_DDFS) 245endif 246 247$(FULLBIN_ROOT)/%.ddf: $(MAKEFILE) 248 @$(INSTALL) -p -D $(REX_DDFTMPLTDIR)/NdevRun_$(REX_TITLEFW)_$(REX_TITLEID).ddf $@ 249 @if [ -e $(TARGET_APPLOADER_DDF) ]; then \ 250 cat $(TARGET_APPLOADER_DDF) >> $@; \ 251 fi 252ifneq ($(REX_DVDROOT),) 253 @echo "DvdRoot=\"`cygpath -w '$(REX_DVDROOT)'`\"" >> $@ 254endif 255 256# 257# make install 258# 259install: override INSTALL_ROOT = $(REX_INSTALL_DIR)/$(ARCH_TARGET)/$(REX_INSTALL_SUBDIR) 260 261install: rex-install 262 263rex-install: build 264ifdef REX_TOOL 265 @$(MKDIRP) $(INSTALL_ROOT); \ 266 rm -fr bin/$(ARCH_TARGET)/*.map; \ 267 cp -uRp bin/$(ARCH_TARGET)/* $(INSTALL_ROOT) 268endif 269 270 271# 272# make clean 273# 274clean: my-clean 275 276my-clean:; rm -fr *.map ./bin ./depend ./lib ./obj 277 278clean: override CSRCS= 279 280# 281# make distclean/clobber 282# 283distclean clobber: override INSTALL_ROOT = $(REX_INSTALL_DIR)/$(ARCH_TARGET) 284 285ifdef LIB 286ifdef LIBNAME 287REX_DISTCLEAN += $(INSTALL_ROOT)/lib/$(LIBNAME).a $(INSTALL_ROOT)/lib/$(LIBNAME)D.a 288endif 289endif 290 291ifdef TEST 292REX_DISTCLEAN += $(INSTALL_ROOT)/bin/tests/$(MODULENAME) 293endif 294 295ifdef REX_TOOL 296REX_DISTCLEAN += $(addprefix $(INSTALL_ROOT)/$(REX_INSTALL_SUBDIR)/,$(addsuffix *.*,$(BINNAMES))) 297endif 298 299clobber: distclean 300 301distclean: clean 302 rm -rf $(REX_DISTCLEAN) 303 304 305#======== End of modulerules.rex ========# 306