Use same top level Makefile for nacl and linux builds.

Also, re-use some of the concepts from the linux build
system (such as quite by default) in the nacl build.

Fix remaining warnings in NaCl builds.
This commit is contained in:
Sam Clegg 2013-03-04 10:19:50 -08:00
parent 8677dad3c6
commit 7ad171d8ee
16 changed files with 128 additions and 252 deletions

View File

@ -8,23 +8,12 @@ include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
TARGET = $(LIB_DIR)/libcocosdenshion.a
####### Build rules
$(TARGET): $(OBJECTS)
all: $(TARGET)
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
$(LOG_AR)$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) $(DEPS) core
-include $(DEPS)
.PHONY: clean all
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@

View File

@ -18,7 +18,6 @@ if [ -z "$NACL_SDK_ROOT" ]; then
exit 1
fi
MAKEFLAGS=-j10
SCRIPT_DIR=$(dirname ${BASH_SOURCE})
OUTPUT_DEBUG=lib/nacl/Debug/
OUTPUT_RELEASE=lib/nacl/Release/
@ -31,45 +30,13 @@ cd $SCRIPT_DIR
mkdir -p $OUTPUT_DEBUG
mkdir -p $OUTPUT_RELEASE
clean()
{
make $MAKEFLAGS -C cocos2dx/proj.nacl $1 clean
make $MAKEFLAGS -C CocosDenshion/proj.nacl $1 clean
make $MAKEFLAGS -C external/chipmunk/proj.nacl $1 clean
make $MAKEFLAGS -C external/Box2D/proj.nacl $1 clean
make $MAKEFLAGS -C scripting/lua/proj.nacl $1 clean
make $MAKEFLAGS -C samples/Cpp/HelloCpp/proj.nacl $1 clean
make $MAKEFLAGS -C samples/Lua/HelloLua/proj.nacl $1 clean
make $MAKEFLAGS -C samples/Cpp/TestCpp/proj.nacl $1 clean
make $MAKEFLAGS -C samples/Lua/TestLua/proj.nacl $1 clean
make $MAKEFLAGS -C samples/Cpp/SimpleGame/proj.nacl $1 clean
}
export MAKEFLAGS="-j10 PLATFORM=nacl"
if [ "$1" = "clean" ]; then
clean DEBUG=1
clean DEBUG=0
make DEBUG=1 clean
make DEBUG=0 clean
exit 0
fi
make $MAKEFLAGS -C cocos2dx/proj.nacl DEBUG=1
make $MAKEFLAGS -C CocosDenshion/proj.nacl DEBUG=1
make $MAKEFLAGS -C external/chipmunk/proj.nacl DEBUG=1
make $MAKEFLAGS -C external/Box2D/proj.nacl DEBUG=1
make $MAKEFLAGS -C scripting/lua/proj.nacl DEBUG=1
make $MAKEFLAGS -C samples/Cpp/HelloCpp/proj.nacl DEBUG=1
make $MAKEFLAGS -C samples/Lua/HelloLua/proj.nacl DEBUG=1
make $MAKEFLAGS -C samples/Cpp/TestCpp/proj.nacl DEBUG=1
make $MAKEFLAGS -C samples/Lua/TestLua/proj.nacl DEBUG=1
make $MAKEFLAGS -C samples/Cpp/SimpleGame/proj.nacl DEBUG=1
make $MAKEFLAGS -C cocos2dx/proj.nacl DEBUG=0
make $MAKEFLAGS -C CocosDenshion/proj.nacl DEBUG=0
make $MAKEFLAGS -C external/chipmunk/proj.nacl DEBUG=0
make $MAKEFLAGS -C external/Box2D/proj.nacl DEBUG=0
make $MAKEFLAGS -C scripting/lua/proj.nacl DEBUG=0
make $MAKEFLAGS -C samples/Cpp/HelloCpp/proj.nacl DEBUG=0
make $MAKEFLAGS -C samples/Lua/HelloLua/proj.nacl DEBUG=0
make $MAKEFLAGS -C samples/Cpp/TestCpp/proj.nacl DEBUG=0
make $MAKEFLAGS -C samples/Lua/TestLua/proj.nacl DEBUG=0
make $MAKEFLAGS -C samples/Cpp/SimpleGame/proj.nacl DEBUG=0
make DEBUG=1 all
make DEBUG=0 all

View File

@ -156,4 +156,3 @@ $(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
$(OBJ_DIR)/%.o: ../%.c $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(LOG_CC)$(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@

View File

@ -133,27 +133,22 @@ SOURCES = ../actions/CCAction.cpp \
include cocos2dx.mk
CXXFLAGS += -Wno-sequence-point
TARGET = $(LIB_DIR)/libcocos2d.a
DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION
all: $(TARGET)
####### Build rules
$(TARGET): $(OBJECTS)
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_AR) $(ARFLAGS) $@ $^
$(LOG_AR)$(NACL_AR) $(ARFLAGS) $@ $(OBJECTS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
$(OBJ_DIR)/%.o: ../%.c $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) $(DEPS) core
-include $(DEPS)
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@

View File

@ -2,13 +2,15 @@
# when building for Native Client. It defines a set of variables that all
# cocos2dx projects have in common.
all:
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++
CCFLAGS ?= -Wall
CXXFLAGS ?= -Wall
CCFLAGS ?= -Wall -Werror
CXXFLAGS ?= -Wall -Werror
ARFLAGS ?= cr
THIS_MAKEFILE := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
@ -27,7 +29,7 @@ endif
NACLPORTS_ROOT ?= $(NACL_SDK_ROOT)/ports
NACLPORTS_INCLUDE ?= $(NACLPORTS_ROOT)/include
OUT_DIR ?= out
OUT_DIR ?= obj
OBJ_DIR ?= $(OUT_DIR)/$(NACL_ARCH)
LIB_DIR ?= $(COCOS_ROOT)/lib/nacl/$(ARCH_DIR)
@ -38,8 +40,8 @@ INCLUDES += -I$(COCOS_SRC) \
-I$(COCOS_SRC)/platform \
-I$(COCOS_SRC)/platform/nacl \
-I$(NACL_SDK_ROOT)/include \
-I$(NACLPORTS_INCLUDE) \
-I$(NACLPORTS_INCLUDE)/libxml2
-isystem $(NACLPORTS_INCLUDE) \
-isystem $(NACLPORTS_INCLUDE)/libxml2
ifeq ($(DEBUG), 1)
BIN_DIR = bin/debug
@ -59,6 +61,13 @@ MULTILIB_SUFFIX := $(ARCH_DIR)/Release
DEFINES += -DNDEBUG
endif
ifndef V
LOG_CC = @echo " CC $@";
LOG_CXX = @echo " CXX $@";
LOG_AR = @echo " AR $@";
LOG_LINK = @echo " LINK $@";
endif
# 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)
@ -87,3 +96,11 @@ OBJECTS := $(subst ../,,$(OBJECTS))
OBJECTS := $(subst $(COCOS_ROOT)/,,$(OBJECTS))
OBJECTS := $(addprefix $(OBJ_DIR)/, $(OBJECTS))
DEPS = $(OBJECTS:.o=.d)
CORE_MAKEFILE_LIST := $(MAKEFILE_LIST)
-include $(DEPS)
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
.PHONY: all clean

View File

@ -40,3 +40,7 @@ EXTENSIONS_SOURCES = ../CCBReader/CCBFileLoader.cpp \
../GUI/CCControlExtension/CCControlStepper.cpp \
../physics_nodes/CCPhysicsDebugNode.cpp \
../physics_nodes/CCPhysicsSprite.cpp
all:
clean:

View File

@ -64,22 +64,12 @@ include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
TARGET = $(LIB_DIR)/libbox2d.a
####### Build rules
all: $(TARGET)
$(TARGET): $(OBJECTS)
@mkdir -p $(@D)
$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
$(LOG_AR)$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
@mkdir -p $(@D)
$(NALC_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
-include $(DEPS)
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@

View File

@ -11,35 +11,35 @@ LIBS =
INCLUDES = -I../include/chipmunk
SOURCES = ../src/chipmunk.cpp \
../src/cpBody.cpp \
../src/cpSpace.cpp \
../src/cpSpatialIndex.cpp \
../src/cpArbiter.cpp \
../src/cpCollision.cpp \
../src/cpSpaceComponent.cpp \
../src/cpSweep1D.cpp \
../src/cpArray.cpp \
../src/cpHashSet.cpp \
../src/cpSpaceHash.cpp \
../src/cpVect.cpp \
../src/cpBB.cpp \
../src/cpPolyShape.cpp \
../src/cpSpaceQuery.cpp \
../src/cpBBTree.cpp \
../src/cpShape.cpp \
../src/cpSpaceStep.cpp \
../src/constraints/cpConstraint.cpp \
../src/constraints/cpPivotJoint.cpp \
../src/constraints/cpDampedRotarySpring.cpp \
../src/constraints/cpRatchetJoint.cpp \
../src/constraints/cpDampedSpring.cpp \
../src/constraints/cpRotaryLimitJoint.cpp \
../src/constraints/cpGearJoint.cpp \
../src/constraints/cpSimpleMotor.cpp \
../src/constraints/cpGrooveJoint.cpp \
../src/constraints/cpSlideJoint.cpp \
../src/constraints/cpPinJoint.cpp
SOURCES = ../src/chipmunk.c \
../src/cpBody.c \
../src/cpSpace.c \
../src/cpSpatialIndex.c \
../src/cpArbiter.c \
../src/cpCollision.c \
../src/cpSpaceComponent.c \
../src/cpSweep1D.c \
../src/cpArray.c \
../src/cpHashSet.c \
../src/cpSpaceHash.c \
../src/cpVect.c \
../src/cpBB.c \
../src/cpPolyShape.c \
../src/cpSpaceQuery.c \
../src/cpBBTree.c \
../src/cpShape.c \
../src/cpSpaceStep.c \
../src/constraints/cpConstraint.c \
../src/constraints/cpPivotJoint.c \
../src/constraints/cpDampedRotarySpring.c \
../src/constraints/cpRatchetJoint.c \
../src/constraints/cpDampedSpring.c \
../src/constraints/cpRotaryLimitJoint.c \
../src/constraints/cpGearJoint.c \
../src/constraints/cpSimpleMotor.c \
../src/constraints/cpGrooveJoint.c \
../src/constraints/cpSlideJoint.c \
../src/constraints/cpPinJoint.c
COCOS_ROOT = ../../..
@ -49,22 +49,10 @@ TARGET = $(LIB_DIR)/libchipmunk.a
all: $(TARGET)
####### Build rules
$(TARGET): $(OBJECTS)
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
$(LOG_AR)$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
$(OBJ_DIR)/%.o: ../%.c $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
-include $(DEPS)
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@

View File

@ -14,28 +14,17 @@ NMF = $(BIN_DIR)/$(APP_NAME).nmf
all: $(NMF)
####### Build rules
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
$(LOG_LINK)$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: %.cpp
$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(NMF): $(TARGET)
$(NACL_SDK_ROOT)/tools/create_nmf.py -o $@ $(BIN_DIR)/*.nexe --objdump=i686-nacl-objdump -L$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/x86_64-nacl/lib/ -s $(BIN_DIR)
@ -44,6 +33,4 @@ run: all
/bin/cp -ar ../Resources/ .
$(NACL_SDK_ROOT)/tools/httpd.py --no_dir_check
-include $(DEPS)
.PHONY: run clean all
.PHONY: run

View File

@ -20,28 +20,17 @@ NMF = $(BIN_DIR)/$(APP_NAME).nmf
all: $(NMF)
####### Build rules
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a
@mkdir -p $(@D)
$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
$(LOG_LINK)$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(NMF): $(TARGET)
$(NACL_SDK_ROOT)/tools/create_nmf.py -o $@ $(BIN_DIR)/*.nexe --objdump=i686-nacl-objdump -L$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/x86_64-nacl/lib/ -s $(BIN_DIR)
@ -50,6 +39,4 @@ run: all
/bin/cp -ar ../Resources/ .
$(NACL_SDK_ROOT)/tools/httpd.py --no_dir_check
-include $(DEPS)
.PHONY: run clean all
.PHONY: run

View File

@ -101,6 +101,8 @@ SOURCES += $(addprefix $(COCOS_ROOT)/extensions/, $(EXTENSIONS_SOURCES))
include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
CXXFLAGS += -Wno-multichar
SHAREDLIBS += -lchipmunk -lbox2d
APP_NAME = TestCpp
@ -109,32 +111,25 @@ NMF = $(BIN_DIR)/$(APP_NAME).nmf
all: $(NMF)
####### Build rules
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a $(LIB_DIR)/libcocosdenshion.a
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a $(LIB_DIR)/libcocosdenshion.a $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
$(LOG_LINK)$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../../../../%.cpp
$(OBJ_DIR)/%.o: ../../../../%.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: %.cpp
$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.c
$(OBJ_DIR)/%.o: ../%.c $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -rf $(OUT_DIR)
rm -f $(TARGET) core
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(NMF): $(TARGET)
$(NACL_SDK_ROOT)/tools/create_nmf.py -o $@ $(BIN_DIR)/*.nexe --objdump=i686-nacl-objdump -L$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/x86_64-nacl/lib/ -s $(BIN_DIR)
@ -156,6 +151,4 @@ run: all
/bin/cp -ar ../Resources/ .
$(NACL_SDK_ROOT)/tools/httpd.py --no_dir_check
-include $(DEPS)
.PHONY: run clean zipfile package
.PHONY: run zipfile package

View File

@ -62,11 +62,13 @@ void* cocos_main(void* arg)
const char* dirnames[] = { "Images", "extensions", "fonts", "ccb",
"zwoptex", "Particles", "Shaders", "TileMaps" };
for (int i = 0; i < sizeof(dirnames)/sizeof(char*); i++)
for (size_t i = 0; i < sizeof(dirnames)/sizeof(char*); i++)
mkdir(dirnames[i], S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
const char* filenames[] = { "Images/grossini.png",
"Images/close.png",
"Images/ball.png",
"Images/paddle.png",
"Images/grossinis_sister1.png",
"Images/grossinis_sister2.png",
"Images/grossini_dance_01.png",

View File

@ -26,30 +26,25 @@ NMF = $(BIN_DIR)/$(APP_NAME).nmf
all: $(NMF)
####### Build rules
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a
@mkdir -p $(@D)
$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
$(LOG_LINK)$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
####### Compile
$(OBJ_DIR)/%.o: ../%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: $(COCOS_ROOT)/%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: $(COCOS_ROOT)/%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) $(DEPS) core
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(NMF): $(TARGET)
$(NACL_SDK_ROOT)/tools/create_nmf.py -o $@ $(BIN_DIR)/*.nexe --objdump=i686-nacl-objdump -L$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/x86_64-nacl/lib/ -s $(BIN_DIR)
@ -57,7 +52,3 @@ $(NMF): $(TARGET)
run: all
/bin/cp -ar ../Resources/ .
$(NACL_SDK_ROOT)/tools/httpd.py --no_dir_check
-include $(DEPS)
.PHONY: run clean run

View File

@ -28,31 +28,25 @@ NMF = $(BIN_DIR)/$(APP_NAME).nmf
all: $(NMF)
####### Build rules
$(TARGET): $(OBJECTS) $(LIB_DIR)/libcocos2d.a
@mkdir -p $(@D)
$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
$(LOG_LINK)$(NACL_CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS)
####### Compile
$(OBJ_DIR)/%.o: %.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: ../%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: $(COCOS_ROOT)/%.cpp
@mkdir -p $(@D)
$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(LOG_CXX)$(NACL_CXX) -MMD $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(OBJ_DIR)/%.o: $(COCOS_ROOT)/%.c
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
clean:
rm -f $(OBJECTS) $(TARGET) $(DEPS) core
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
$(NMF): $(TARGET)
$(NACL_SDK_ROOT)/tools/create_nmf.py -o $@ $(BIN_DIR)/*.nexe --objdump=i686-nacl-objdump -L$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/x86_64-nacl/lib/ -s $(BIN_DIR)
@ -60,7 +54,3 @@ $(NMF): $(TARGET)
run: all
/bin/cp -ar ../Resources/ .
$(NACL_SDK_ROOT)/tools/httpd.py --no_dir_check
-include $(DEPS)
.PHONY: run clean run

View File

@ -63,7 +63,7 @@ void* cocos_main(void* arg)
"zwoptex", "Particles", "Shaders", "luaScript",
"luaScript/ActionsTest" };
for (int i = 0; i < sizeof(dirnames)/sizeof(char*); i++)
for (size_t i = 0; i < sizeof(dirnames)/sizeof(char*); i++)
mkdir(dirnames[i], S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
const char* filenames[] = { "Images/grossini.png",

View File

@ -1,22 +1,5 @@
NACL_ARCH ?= x86_64
NACL_LIBC = newlib
NACL_AR ?= $(NACL_ARCH)-nacl-ar
NACL_CC ?= $(NACL_ARCH)-nacl-gcc
NACL_CXX ?= $(NACL_ARCH)-nacl-g++
CCFLAGS = -Wall
CXXFLAGS = -Wall
VISIBILITY =
ARFLAGS = cr
LIBS =
INCLUDES = -I.. -I../lua
NACLPORTS_INCLUDE ?= $(NACL_SDK_ROOT)/toolchain/linux_x86_$(NACL_LIBC)/$(NACL_ARCH)-nacl/usr/include
INCLUDES += -I$(NACL_SDK_ROOT)/include
INCLUDES += -I$(NACLPORTS_INCLUDE)
SOURCES = ../lua/lapi.c \
../lua/lauxlib.c \
../lua/lbaselib.c \
@ -43,7 +26,6 @@ SOURCES = ../lua/lapi.c \
../lua/ltable.c \
../lua/ltablib.c \
../lua/ltm.c \
../lua/lua.c \
../lua/lundump.c \
../lua/lvm.c \
../lua/lzio.c \
@ -58,19 +40,14 @@ COCOS_ROOT = ../../..
include $(COCOS_ROOT)/cocos2dx/proj.nacl/cocos2dx.mk
TARGET = $(LIB_DIR)/liblua.a
CCFLAGS = -Wno-uninitialized
####### Build rules
$(TARGET): $(OBJECTS)
$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
TARGET = $(LIB_DIR)/liblua.a
all: $(TARGET)
####### Compile
$(OBJ_DIR)/%.o: ../%.c
$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)
$(LOG_AR)$(NACL_AR) $(ARFLAGS) $(TARGET) $(OBJECTS)
$(OBJ_DIR)/%.o: ../%.c $(CORE_MAKEFILE_LIST)
@mkdir -p $(@D)
$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean:
rm -rf $(OBJ_DIR)
rm -f $(TARGET) core
-include $(DEPS)
$(LOG_CC)$(NACL_CC) -MMD $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@