OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # | |
6 # GNU Make based build file. For details on GNU Make see: | |
7 # http://www.gnu.org/software/make/manual/make.html | |
8 # | |
9 # | |
10 | |
11 # | |
12 # Default configuration | |
13 # | |
14 # By default we will build a Debug configuration using the GCC newlib toolcahin | |
15 # to override this, specify TOOLCHAIN=newlib|glibc or CONFIG=Debug|Release on | |
16 # the make command-line or in this file prior to including common.mk. The | |
17 # toolchain we use by default will be the first valid one listed | |
18 VALID_TOOLCHAINS:="newlib glibc" | |
19 TOOLCHAIN?=newlib | |
20 | |
21 OUTBASE:=out | |
22 | |
23 # | |
24 # Target Name | |
25 # | |
26 # The base name of the final NEXE, also the name of the NMF file containing | |
27 # the mapping between architecture and actual NEXE. | |
28 # | |
29 TARGET:=nacltoons | |
30 | |
31 COCOS_ROOT = ../third_party/cocos2d-x | |
32 | |
33 # | |
34 # List of sources to compile | |
35 # | |
36 SOURCES := src/main.cc \ | |
37 src/app_delegate.cc \ | |
38 src/game_manager.cc \ | |
39 src/level_layer.cc \ | |
40 bindings/LuaBox2D.cpp \ | |
41 bindings/lua_level_layer.cpp \ | |
42 bindings/LuaCocos2dExtensions.cpp \ | |
43 $(COCOS_ROOT)/samples/Cpp/TestCpp/Classes/Box2DTestBed/GLES-Render.cp
p \ | |
44 $(COCOS_ROOT)/extensions/physics_nodes/CCPhysicsDebugNode.cpp \ | |
45 $(COCOS_ROOT)/extensions/physics_nodes/CCPhysicsSprite.cpp \ | |
46 $(COCOS_ROOT)/scripting/lua/cocos2dx_support/CCLuaEngine.cpp \ | |
47 $(COCOS_ROOT)/scripting/lua/cocos2dx_support/CCLuaStack.cpp \ | |
48 $(COCOS_ROOT)/scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \ | |
49 $(COCOS_ROOT)/scripting/lua/cocos2dx_support/LuaCocos2d.cpp \ | |
50 $(COCOS_ROOT)/scripting/lua/cocos2dx_support/tolua_fix.c | |
51 | |
52 | |
53 PAGE:=$(OUTBASE)/publish/index.html | |
54 | |
55 # | |
56 # Get pepper directory for toolchain and includes. | |
57 # | |
58 # If NACL_SDK_ROOT is not set, then assume it can be found relative to | |
59 # to this Makefile. | |
60 # | |
61 ifndef NACL_SDK_ROOT | |
62 $(error NACL_SDK_ROOT not set) | |
63 endif | |
64 | |
65 NACL_SDK_VERSION_MIN := 27.186236 | |
66 include $(NACL_SDK_ROOT)/tools/common.mk | |
67 | |
68 # TODO(noelallen) override to remove incognito until Chrome fix | |
69 CHROME_ARGS:=--enable-nacl --ppapi-out-of-process --no-first-run --user-data-dir
=$(OUTBASE)/user-data-dir | |
70 | |
71 # In recent SDK versions defining NACL_SDK_VERSION_MIN is enough to trigger and
error | |
72 # but older SDKs didn't know about this so we check for older versions that don'
t | |
73 # support --sdk-version | |
74 SDK_VERSION := $(shell $(GETOS) --sdk-version) | |
75 ifndef SDK_VERSION | |
76 $(error You need a more recent version of the NaCl SDK (>= $(NACL_SDK_VERSION_
MIN))) | |
77 endif | |
78 | |
79 CFLAGS += -DCOCOS2D_DEBUG -DCC_ENABLE_BOX2D_INTEGRATION | |
80 CFLAGS += -Wall -Wno-unknown-pragmas | |
81 | |
82 COCOS2DX_PATH = $(OUTBASE)/cocos2dx | |
83 | |
84 # By default we pull naclports from the installed SDK, but we can | |
85 # build and use them locally by defining LOCAL_PORTS | |
86 ifdef LOCAL_PORTS | |
87 NACLPORTS_ROOT = $(OUTBASE)/naclports | |
88 else | |
89 NACLPORTS_ROOT = $(NACL_SDK_ROOT)/ports | |
90 endif | |
91 | |
92 CINCLUDE= \ | |
93 -Isrc \ | |
94 -Ibindings \ | |
95 -I$(COCOS2DX_PATH) \ | |
96 -I$(COCOS2DX_PATH)/cocoa \ | |
97 -I$(COCOS2DX_PATH)/external \ | |
98 -I$(COCOS2DX_PATH)/include \ | |
99 -I$(COCOS2DX_PATH)/platform/nacl \ | |
100 -I$(COCOS2DX_PATH)/kazmath/include \ | |
101 -I$(NACL_SDK_ROOT)/include \ | |
102 -I$(NACLPORTS_ROOT)/include \ | |
103 -I../third_party/cocos2d-x/external \ | |
104 -I../third_party/cocos2d-x/extensions \ | |
105 -I../third_party/cocos2d-x/samples/Cpp/TestCpp/Classes/Box2DTestBed | |
106 | |
107 LIB_PATHS += $(COCOS2DX_PATH)/lib | |
108 LIB_PATHS += $(NACLPORTS_ROOT)/lib | |
109 | |
110 # | |
111 # List of libraries to link against. Unlike some tools, the GCC and LLVM | |
112 # based tools require libraries to be specified in the correct order. The | |
113 # order should be symbol reference followed by symbol definition, with direct | |
114 # sources to the link (object files) are left most. In this case: | |
115 # hello_world -> ppapi_main -> ppapi_cpp -> ppapi -> pthread -> libc | |
116 # Notice that libc is implied and come last through standard compiler/link | |
117 # switches. | |
118 # | |
119 # We break this list down into two parts, the set we need to rebuild (DEPS) | |
120 # and the set we do not. This example does not havea any additional library | |
121 # dependencies. | |
122 # | |
123 DEPS= | |
124 SOUNDLIBS=cocosdenshion alut openal vorbisfile vorbis ogg | |
125 LIBS=$(DEPS) lua cocos2d $(SOUNDLIBS) freetype box2d xml2 png12 jpeg tiff webp | |
126 LIBS+=nacl_io ppapi_gles2 ppapi ppapi_cpp z | |
127 | |
128 GLIBC_PATHS+=-L$(TC_PATH)/$(OSNAME)_x86_glibc/i686-nacl/usr/lib | |
129 GLIBC_PATHS+=-L$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/usr/lib | |
130 | |
131 # | |
132 # Use the library dependency macro for each dependency | |
133 # | |
134 $(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep)))) | |
135 | |
136 # | |
137 # Use the compile macro for each source. | |
138 # | |
139 $(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS),$(CINCLUDE)
))) | |
140 | |
141 # | |
142 # Use the link macro for this target on the list of sources. | |
143 # | |
144 $(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS))) | |
145 | |
146 # | |
147 # Specify the NMF to be created with no additional arugments. | |
148 # | |
149 $(eval $(call NMF_RULE,$(TARGET),)) | |
150 | |
151 # | |
152 # Add extra dependencies so that our final targets get rebuilt whenever | |
153 # cocos2dx or its dependencies change. | |
154 # | |
155 $(OUTDIR)/$(TARGET)_x86_64.nexe: \ | |
156 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG)/libcocos2d.a \ | |
157 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG)/liblua.a \ | |
158 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_64/$(CONFIG)/libbox2d.a | |
159 | |
160 $(OUTDIR)/$(TARGET)_arm.nexe: \ | |
161 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_arm/$(CONFIG)/libcocos2d.a \ | |
162 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_arm/$(CONFIG)/liblua.a \ | |
163 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_arm/$(CONFIG)/libbox2d.a | |
164 | |
165 $(OUTDIR)/$(TARGET)_x86_32.nexe: \ | |
166 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG)/libcocos2d.a \ | |
167 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG)/liblua.a \ | |
168 $(COCOS2DX_PATH)/lib/$(TOOLCHAIN)_x86_32/$(CONFIG)/libbox2d.a | |
OLD | NEW |