2013-03-02 01:09:58 +08:00
|
|
|
# This makefile is included by each of the cocos2d-x libraries and examples
|
|
|
|
# when building for Native Client. It defines a set of variables that all
|
|
|
|
# cocos2dx projects have in common.
|
|
|
|
|
2013-03-05 02:19:50 +08:00
|
|
|
all:
|
|
|
|
|
2013-03-02 01:09:58 +08:00
|
|
|
NACL_LIBC = newlib
|
|
|
|
NACL_ARCH ?= x86_64
|
|
|
|
NACL_AR ?= $(NACL_ARCH)-nacl-ar
|
|
|
|
NACL_CC ?= $(NACL_ARCH)-nacl-gcc
|
|
|
|
NACL_CXX ?= $(NACL_ARCH)-nacl-g++
|
2013-06-21 03:15:42 +08:00
|
|
|
CCFLAGS += -Wall -Werror -Wno-deprecated-declarations
|
2013-06-03 13:50:19 +08:00
|
|
|
# GCC 4.6 is primary platform for cocos2d v.3, because it's default compiler for Android,
|
|
|
|
# Blackberry, some Linux distributions.It supports all important features of c++11, but have
|
|
|
|
# no flag "-std=c++11" (which was turned on in version 4.7).
|
2013-06-21 03:15:42 +08:00
|
|
|
CXXFLAGS += -Wall -Werror -Wno-deprecated-declarations -std=gnu++0x
|
2013-03-05 06:37:20 +08:00
|
|
|
ARFLAGS = cr
|
2013-03-02 01:09:58 +08:00
|
|
|
|
|
|
|
THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
|
|
|
|
|
|
# The top level of the cocos2dx-x source tree. The parent Makefile will
|
|
|
|
# often define this, but in case is doesn't we can find it relative to
|
|
|
|
# THIS_MAKEFILE
|
2013-03-21 02:47:24 +08:00
|
|
|
ifndef COCOS_ROOT
|
|
|
|
COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)
|
|
|
|
endif
|
|
|
|
COCOS_SRC := $(COCOS_ROOT)/cocos2dx
|
2013-03-02 01:09:58 +08:00
|
|
|
|
|
|
|
ifeq ($(NACL_ARCH), i686)
|
2013-03-21 02:47:24 +08:00
|
|
|
ARCH_DIR := $(NACL_LIBC)_x86_32
|
2013-03-02 01:09:58 +08:00
|
|
|
else
|
2013-03-21 02:47:24 +08:00
|
|
|
ARCH_DIR := $(NACL_LIBC)_$(NACL_ARCH)
|
2013-03-02 01:09:58 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
NACLPORTS_ROOT ?= $(NACL_SDK_ROOT)/ports
|
|
|
|
NACLPORTS_INCLUDE ?= $(NACLPORTS_ROOT)/include
|
2013-03-05 02:19:50 +08:00
|
|
|
OUT_DIR ?= obj
|
2013-03-02 01:09:58 +08:00
|
|
|
OBJ_DIR ?= $(OUT_DIR)/$(NACL_ARCH)
|
|
|
|
LIB_DIR ?= $(COCOS_ROOT)/lib/nacl/$(ARCH_DIR)
|
|
|
|
|
2013-03-21 02:47:24 +08:00
|
|
|
ifdef USE_BOX2D
|
2013-04-17 12:49:25 +08:00
|
|
|
DEFINES += -DCC_ENABLE_BOX2D_INTEGRATION=1
|
2013-03-21 02:47:24 +08:00
|
|
|
else
|
2013-04-17 12:49:25 +08:00
|
|
|
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
2013-03-21 02:47:24 +08:00
|
|
|
endif
|
|
|
|
|
2013-03-02 01:09:58 +08:00
|
|
|
INCLUDES += -I$(COCOS_SRC) \
|
|
|
|
-I$(COCOS_SRC)/cocoa \
|
|
|
|
-I$(COCOS_SRC)/include \
|
|
|
|
-I$(COCOS_SRC)/kazmath/include \
|
|
|
|
-I$(COCOS_SRC)/platform \
|
|
|
|
-I$(COCOS_SRC)/platform/nacl \
|
|
|
|
-I$(NACL_SDK_ROOT)/include \
|
2013-03-05 02:19:50 +08:00
|
|
|
-isystem $(NACLPORTS_INCLUDE) \
|
|
|
|
-isystem $(NACLPORTS_INCLUDE)/libxml2
|
2013-03-02 01:09:58 +08:00
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
BIN_DIR = bin/debug
|
|
|
|
CCFLAGS += -g3 -O0
|
|
|
|
CXXFLAGS += -g3 -O0
|
|
|
|
LIB_DIR := $(LIB_DIR)/Debug
|
|
|
|
OBJ_DIR := $(OBJ_DIR)/Debug
|
|
|
|
MULTILIB_SUFFIX := $(ARCH_DIR)/Debug
|
2013-03-13 07:52:10 +08:00
|
|
|
DEFINES += -D_DEBUG -DCOCOS2D_DEBUG=1
|
2013-03-02 01:09:58 +08:00
|
|
|
else
|
|
|
|
BIN_DIR = bin/release
|
|
|
|
CCFLAGS += -O3
|
|
|
|
CXXFLAGS += -O3
|
|
|
|
LIB_DIR := $(LIB_DIR)/Release
|
|
|
|
OBJ_DIR := $(OBJ_DIR)/Release
|
|
|
|
MULTILIB_SUFFIX := $(ARCH_DIR)/Release
|
|
|
|
DEFINES += -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
2013-03-05 02:19:50 +08:00
|
|
|
ifndef V
|
|
|
|
LOG_CC = @echo " CC $@";
|
|
|
|
LOG_CXX = @echo " CXX $@";
|
|
|
|
LOG_AR = @echo " AR $@";
|
|
|
|
LOG_LINK = @echo " LINK $@";
|
|
|
|
endif
|
|
|
|
|
2013-03-02 01:09:58 +08:00
|
|
|
# The default library search path consists of the cocos2dx library path, the
|
|
|
|
# main nacl sdk library path and the naclports library path.
|
|
|
|
LDFLAGS += -L$(LIB_DIR)
|
|
|
|
LDFLAGS += -L$(NACL_SDK_ROOT)/lib/$(MULTILIB_SUFFIX)
|
|
|
|
LDFLAGS += -L$(NACLPORTS_ROOT)/lib/$(MULTILIB_SUFFIX)
|
|
|
|
|
|
|
|
# Some cococs sources use #pragma mark
|
|
|
|
CCFLAGS += -Wno-unknown-pragmas
|
|
|
|
CXXFLAGS += -Wno-unknown-pragmas
|
|
|
|
|
2013-03-05 06:37:20 +08:00
|
|
|
ifeq ($(NACL_ARCH),arm)
|
|
|
|
# Don't warn about mangling of 'va_list' on arm builds
|
|
|
|
CCFLAGS += -Wno-psabi
|
|
|
|
CXXFLAGS += -Wno-psabi
|
|
|
|
endif
|
|
|
|
|
2013-03-02 01:09:58 +08:00
|
|
|
ifdef NACL_MOUNTS
|
|
|
|
DEFINES += -DOLD_NACL_MOUNTS
|
|
|
|
STATICLIBS += -lnacl-mounts
|
|
|
|
else
|
|
|
|
STATICLIBS += -lnacl_io
|
|
|
|
endif
|
|
|
|
|
|
|
|
SOUNDLIBS := -lalut -lopenal -lvorbisfile -lvorbis -logg
|
2013-05-24 11:42:27 +08:00
|
|
|
STATICLIBS += $(SOUNDLIBS) -lfreetype -lxml2 -lwebp -lpng -ljpeg -ltiff -llua -lchipmunk
|
2013-03-02 01:09:58 +08:00
|
|
|
STATICLIBS += -lppapi_gles2 -lppapi -lppapi_cpp -lnosys
|
|
|
|
SHAREDLIBS += -lpthread -lcocosdenshion -lcocos2d -lz
|
|
|
|
|
|
|
|
OBJECTS := $(SOURCES:.cpp=.o)
|
|
|
|
OBJECTS := $(OBJECTS:.c=.o)
|
|
|
|
OBJECTS := $(subst ../,,$(OBJECTS))
|
|
|
|
OBJECTS := $(subst $(COCOS_ROOT)/,,$(OBJECTS))
|
|
|
|
OBJECTS := $(addprefix $(OBJ_DIR)/, $(OBJECTS))
|
|
|
|
DEPS = $(OBJECTS:.o=.d)
|
2013-03-05 02:19:50 +08:00
|
|
|
CORE_MAKEFILE_LIST := $(MAKEFILE_LIST)
|
|
|
|
-include $(DEPS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OBJ_DIR)
|
|
|
|
rm -f $(TARGET) core
|
|
|
|
|
|
|
|
.PHONY: all clean
|