1#!/usr/bin/env omake 2#---------------------------------------------------------------------------- 3# Project: NintendoWare 4# File: commondefs.om 5# 6# Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. 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# $Revision: 28420 $ 15#---------------------------------------------------------------------------- 16 17NW4C_ROOT = $(getenv NW4C_ROOT) 18 19CTRSDK_ROOT = $(getenv CTRSDK_ROOT) 20 21if $(and $(not $(defined FILTER)), $(defined NW_TARGET)) 22 NW_TARGET_ITEMS = $(split $".", $(NW_TARGET)) 23 if $(filter fast, $(NW_TARGET_ITEMS)) 24 FILTER=Process.MPCore.fast 25 export 26 elseif $(filter small, $(NW_TARGET_ITEMS)) 27 FILTER=Process.MPCore.small 28 export 29 elseif $(filter *, $(NW_TARGET_ITEMS)) 30 FILTER=Process.MPCore.* 31 export 32 else 33 FILTER=Process.MPCore.fast 34 export 35 36 if $(filter TEG2, $(NW_TARGET_ITEMS)) 37 FILTER=CTR-TEG2.$(FILTER) 38 export 39 elseif $(filter TS, $(NW_TARGET_ITEMS)) 40 FILTER=CTR-TS.$(FILTER) 41 export 42 else 43 FILTER=CTR-TS.$(FILTER) 44 export 45 46 export 47 48# �v���C�x�[�g���p�̏����ݒ��ǂݍ��� 49if $(test -e $(NW4C_ROOT)/build/omake/private/commondefs_prolog.om) 50 include $(NW4C_ROOT)/build/omake/private/commondefs_prolog 51 export 52 53include $(getenv CTRSDK_ROOT)/build/omake/commondefs 54 55# INSTALL_ROOT ��ݒ肵�Ă��Ȃ��ƒ�`����Ȃ����Ή� 56INSTALL_ROOT_LIBRARIES = $`(dir $(INSTALL_ROOT)$(DIRSEP)$(SUBDIR_LIBRARIES)) 57 58CCFLAGS += --gnu -DNN_SWITCH_ENABLE_MEMBER_NAME_SHORTCUT=1 59CCFLAGS_WARNING += --diag_suppress 2815,3007,3017,9931 60LDFLAGS += --diag_suppress 9931 61SHASM_FLAGS = 62 63 64NW_USE_COMMAND_CACHE=1 65 66if $(defined NW_DEV_DISABLED) 67 CCFLAGS += -DNW_DEV_DISABLED=1 68 export 69 70if $(defined NW_USE_COMMAND_CACHE) 71 CCFLAGS += -DNW_USE_COMMAND_CACHE=1 72 SHASM_FLAGS += -DNW_USE_COMMAND_CACHE=1 73 export 74 75if $(defined NW_IGNORE_DEPRECATED) 76 CCFLAGS += -DNW_IGNORE_DEPRECATED=1 77 SHASM_FLAGS += -DNW_IGNORE_DEPRECATED=1 78 export 79 80NW_INCLUDES[] = 81 $(NW4C_ROOT)/include 82 83INCLUDES[] += $(NW_INCLUDES) 84 85SHADERS_DIR = shaders 86IMAGES_DIR = images 87 88INSTALL_ROOT_SHADERS = $(getenv NW4C_ROOT)$(DIRSEP)$(SHADERS_DIR) 89 90NW_LIBRARIES[] = 91 libnw_math 92 libnw_os 93 libnw_ut 94 libnw_anim 95 libnw_font 96 libnw_gfx 97 libnw_lyt 98 libnw_io 99 libnw_snd 100 libnw_dev 101 102LIBFILES += $`(addprefix $(NW4C_ROOT)$(DIRSEP)$(SUBDIR_LIBRARIES)$(DIRSEP)$(config.getTargetSubDirectory true)$(DIRSEP), $(NW_LIBRARIES)) 103 104CTR_CMDLINE_TOOLS = $(CTRSDK_ROOT)/tools/CommandLineTools 105FONT_CONVERTER = $(NW4C_ROOT)/tools/FontConverter/NW4C_FontConverterConsole.exe 106VERTEX_SHADER_ASSEMBLER = $(CTR_CMDLINE_TOOLS)/ctr_VertexShaderAssembler32.exe 107VERTEX_SHADER_LINKER = $(CTR_CMDLINE_TOOLS)/ctr_VertexShaderLinker32.exe 108 109VERTEX_SHADER_INCLUDES[] = 110GEOMETRY_SHADER_INCLUDES[] = 111 112NW_LYT_SHADER_NAMES[] = 113 nwfont_TextWriterShader.shbin 114 nwfont_RectDrawerShader.shbin 115 nwlyt_PaneShader.shbin 116 nwlyt_ConstColorShader.shbin 117 118public.VertexShaderObject(files) = 119 OFILES = 120 OBJDIR = objects 121 122 foreach(file, $(files)) 123 OFILE = $(OBJDIR)$(DIRSEP)$(rootname $(basename $(file))).o 124 $(OFILE): $(file) 125 mkdir -p $(dirname $@) 126 $(VERTEX_SHADER_ASSEMBLER) $`(SHASM_FLAGS) $(addprefix -I,$(VERTEX_SHADER_INCLUDES)) -O$@ $< -nowarning 127 OFILES += $(OFILE) 128 export OFILES 129 return $(OFILES) 130 131 132public.VertexShader(name, files, isLibrary) = 133 OBJDIR = objects 134 OBJS = $(VertexShaderObject $(files)) 135 OFILE = $(name).shbin 136 SHBIN = $(IMAGES_DIR)$(DIRSEP)$(OFILE) 137 OTARGET = $(SHBIN) 138 139 $(SHBIN): $(OBJS) $(GEOMETRY_SHADER_INCLUDES) 140 mkdir -p $(dirname $@) 141 $(VERTEX_SHADER_LINKER) -M -O$@ $+ 142 143 if $(isLibrary) 144 OTARGET = $(INSTALL_ROOT_SHADERS)$(DIRSEP)$(OFILE) 145 146 $(OTARGET): $(SHBIN) 147 cp -f $< $@ 148 149 export OTARGET 150 151 clean: 152 rm -f $(OBJS) 153 154 return $(OTARGET) 155 156# UNDONE: ���Ή� 157public.PrecompiledHeader(config, sources) = 158 private.TARGET_DIR = $(NW4C_ROOT)/pch/$(config.getTargetSubDirectory false) 159 public.CCFLAGS += --pch_dir=$(TARGET_DIR) --create_pch=$(TARGET_LIBRARY).pch 160 EXPLICIT = true 161 private.OFILES = $(Object $(config), $(sources)) 162 private.OTARGET = $(TARGET_DIR)/$(TARGET_LIBRARY).pch 163 164 return $(OFILES) 165 166 167public.Font(output, options) = 168 # TODO: extract config files as depends. 169 DEPS[] = 170 $(output): $(DEPS) 171 mkdir -p $(dirname $@) 172 $(FONT_CONVERTER) -of $(output) $(options) 173 return $(output) 174# 175# dir2 �� dir1 �Ɠ��������̃T�u�f�B���N�g���̏ꍇ�� true ��Ԃ��B 176# 177public.InDirectory(dir1, dir2) = 178 dir1 = $(lowercase $(absname $(dir1))) 179 dir2 = $(lowercase $(absname $(dir2))) 180 seqDir1 = $(split $(DIRSEP), $(dir1)) 181 seqDir2 = $(split $(DIRSEP), $(dir2)) 182 if $(gt $(length $(seqDir1)), $(length $(seqDir2))) 183 return false 184 else 185 seqBaseDir = $(subrange 0, $(length $(seqDir1)), $(seqDir2)) 186 return $(equal $(dir1), $(concat $(DIRSEP), $(seqBaseDir))) 187 188# 189# omake �� directory �ȉ��̃f�B���N�g���Ŏ��s���ꂽ�̂��ׂ�B 190# 191# cygwin ��p�B 192# 193public.InvokeInDirectory(directory) = 194 if $(not $(and $(defined-env PWD), $(exists-in-path cygpath))) 195 return false 196 else 197 execDir = $(shell cygpath -a -w $(getenv PWD)) 198 return $(InDirectory $(directory), $(execDir)) 199 200 201if $(test -e $(ROOT)/build/omake/private/commondefs.om) 202 include $(ROOT)/build/omake/private/commondefs 203 export 204 205if $(defined NW_PRIVATE) 206 NW4C_TREE_ROOT = $(NW_DEV_ROOT) 207 export NW4C_TREE_ROOT 208else 209 NW4C_TREE_ROOT = $(NW4C_ROOT) 210 export NW4C_TREE_ROOT 211 212.PHONY: help 213 214help: 215 if $(defined NW_PRIVATE) 216 cat $(NW4C_ROOT)/build/omake/help.txt $(NW4C_ROOT)/build/omake/private/help.txt 217 else 218 cat $(NW4C_ROOT)/build/omake/help.txt 219 220