2013-03-03 10:30:39 +08:00
|
|
|
all:
|
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
CXX = g++
|
2013-05-31 15:18:20 +08:00
|
|
|
# Remove -Wall, because it enables -Wunused-function, and this warning exists in webp.h
|
|
|
|
# when enable c++11. I don't know why.
|
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-05-31 15:18:20 +08:00
|
|
|
CCFLAGS += -MMD -Werror -fPIC
|
2013-06-03 13:50:19 +08:00
|
|
|
CXXFLAGS += -MMD -Werror -fPIC -std=gnu++0x
|
2013-03-03 10:30:39 +08:00
|
|
|
ARFLAGS = cr
|
|
|
|
|
|
|
|
DEFINES += -DLINUX
|
|
|
|
|
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-03 10:30:39 +08:00
|
|
|
THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
|
|
|
ifndef COCOS_ROOT
|
2013-03-16 23:58:29 +08:00
|
|
|
COCOS_ROOT := $(realpath $(dir $(THIS_MAKEFILE))/../..)
|
2013-03-03 10:30:39 +08:00
|
|
|
endif
|
|
|
|
COCOS_SRC = $(COCOS_ROOT)/cocos2dx
|
|
|
|
OBJ_DIR ?= obj
|
|
|
|
|
2013-03-16 23:58:29 +08:00
|
|
|
LIB_DIR = $(COCOS_ROOT)/lib/linux
|
2013-03-03 10:30:39 +08:00
|
|
|
BIN_DIR = bin
|
|
|
|
|
|
|
|
INCLUDES += \
|
|
|
|
-I$(COCOS_SRC) \
|
|
|
|
-I$(COCOS_SRC)/cocoa \
|
|
|
|
-I$(COCOS_SRC)/include \
|
|
|
|
-I$(COCOS_SRC)/kazmath/include \
|
|
|
|
-I$(COCOS_SRC)/platform/linux \
|
|
|
|
-I$(COCOS_SRC)/platform/third_party/linux/libpng \
|
|
|
|
-I$(COCOS_SRC)/platform/third_party/linux/libjpeg \
|
|
|
|
-I$(COCOS_SRC)/platform/third_party/linux/libtiff/include \
|
|
|
|
-I$(COCOS_SRC)/platform/third_party/linux/libwebp
|
|
|
|
|
|
|
|
LBITS := $(shell getconf LONG_BIT)
|
|
|
|
ifeq ($(LBITS),64)
|
|
|
|
INCLUDES += -I$(COCOS_SRC)/platform/third_party/linux/include64
|
|
|
|
else
|
|
|
|
INCLUDES += -I$(COCOS_SRC)/platform/third_party/linux
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CCFLAGS += -g3 -O0
|
|
|
|
CXXFLAGS += -g3 -O0
|
2013-03-13 07:52:10 +08:00
|
|
|
DEFINES += -D_DEBUG -DCOCOS2D_DEBUG=1
|
2013-03-03 10:30:39 +08:00
|
|
|
OBJ_DIR := $(OBJ_DIR)/debug
|
|
|
|
LIB_DIR := $(LIB_DIR)/debug
|
|
|
|
BIN_DIR := $(BIN_DIR)/debug
|
|
|
|
else
|
|
|
|
CCFLAGS += -O3
|
|
|
|
CXXFLAGS += -O3
|
|
|
|
DEFINES += -DNDEBUG
|
|
|
|
OBJ_DIR := $(OBJ_DIR)/release
|
|
|
|
LIB_DIR := $(LIB_DIR)/release
|
|
|
|
BIN_DIR := $(BIN_DIR)/release
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef V
|
|
|
|
LOG_CC = @echo " CC $@";
|
|
|
|
LOG_CXX = @echo " CXX $@";
|
|
|
|
LOG_AR = @echo " AR $@";
|
|
|
|
LOG_LINK = @echo " LINK $@";
|
|
|
|
endif
|
|
|
|
|
|
|
|
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)
|
|
|
|
CORE_MAKEFILE_LIST := $(MAKEFILE_LIST)
|
|
|
|
-include $(DEPS)
|
|
|
|
|
|
|
|
ifeq ($(LBITS),64)
|
|
|
|
STATICLIBS_DIR = $(COCOS_SRC)/platform/third_party/linux/libraries/lib64
|
|
|
|
else
|
|
|
|
STATICLIBS_DIR = $(COCOS_SRC)/platform/third_party/linux/libraries
|
|
|
|
endif
|
|
|
|
STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \
|
|
|
|
$(STATICLIBS_DIR)/libpng.a \
|
|
|
|
$(STATICLIBS_DIR)/libjpeg.a \
|
|
|
|
$(STATICLIBS_DIR)/libtiff.a \
|
|
|
|
$(STATICLIBS_DIR)/libwebp.a
|
|
|
|
|
2013-03-28 18:53:20 +08:00
|
|
|
ifneq ($(OPENAL),1)
|
2013-03-03 10:30:39 +08:00
|
|
|
ifeq ($(LBITS),64)
|
|
|
|
FMOD_LIBDIR = $(COCOS_ROOT)/CocosDenshion/third_party/fmod/lib64/api/lib
|
|
|
|
SHAREDLIBS += -lfmodex64
|
|
|
|
else
|
|
|
|
FMOD_LIBDIR = $(COCOS_ROOT)/CocosDenshion/third_party/fmod/api/lib
|
|
|
|
SHAREDLIBS += -lfmodex
|
|
|
|
endif
|
2013-03-28 18:53:20 +08:00
|
|
|
endif
|
2013-03-03 10:30:39 +08:00
|
|
|
|
2013-03-20 06:39:25 +08:00
|
|
|
SHAREDLIBS += -lglfw -lGLEW -lfontconfig -lpthread -lGL
|
2013-03-16 23:58:29 +08:00
|
|
|
SHAREDLIBS += -L$(FMOD_LIBDIR) -Wl,-rpath,$(abspath $(FMOD_LIBDIR))
|
|
|
|
SHAREDLIBS += -L$(LIB_DIR) -Wl,-rpath,$(abspath $(LIB_DIR))
|
2013-04-10 14:17:23 +08:00
|
|
|
|
2013-05-25 02:29:23 +08:00
|
|
|
LIBS = -lrt -lz -lX11
|
2013-03-03 10:30:39 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OBJ_DIR)
|
|
|
|
rm -f $(TARGET) core
|
|
|
|
|
|
|
|
.PHONY: all clean
|
2013-03-09 02:00:21 +08:00
|
|
|
|
|
|
|
# If the parent Makefile defines $(EXECUTABLE) then define this as the target
|
|
|
|
# and create a 'make run' rule to run the app.
|
|
|
|
ifdef EXECUTABLE
|
|
|
|
TARGET := $(BIN_DIR)/$(EXECUTABLE)
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
run: $(TARGET)
|
|
|
|
cd $(dir $^) && ./$(notdir $^)
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
endif
|