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