From 7ad171d8ee79ef9951d27d584f47f129660a457e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 4 Mar 2013 10:19:50 -0800 Subject: [PATCH] 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. --- CocosDenshion/proj.nacl/Makefile | 23 ++----- build-nacl.sh | 43 ++----------- cocos2dx/proj.linux/Makefile | 1 - cocos2dx/proj.nacl/Makefile | 21 +++--- cocos2dx/proj.nacl/cocos2dx.mk | 27 ++++++-- extensions/proj.nacl/Makefile | 4 ++ external/Box2D/proj.nacl/Makefile | 18 ++---- external/chipmunk/proj.nacl/Makefile | 78 ++++++++++------------- samples/Cpp/HelloCpp/proj.nacl/Makefile | 27 ++------ samples/Cpp/SimpleGame/proj.nacl/Makefile | 21 ++---- samples/Cpp/TestCpp/proj.nacl/Makefile | 33 ++++------ samples/Cpp/TestCpp/proj.nacl/main.cpp | 4 +- samples/Lua/HelloLua/proj.nacl/Makefile | 19 ++---- samples/Lua/TestLua/proj.nacl/Makefile | 20 ++---- samples/Lua/TestLua/proj.nacl/main.cpp | 2 +- scripting/lua/proj.nacl/Makefile | 39 +++--------- 16 files changed, 128 insertions(+), 252 deletions(-) diff --git a/CocosDenshion/proj.nacl/Makefile b/CocosDenshion/proj.nacl/Makefile index edc7e4a62e..7988e4b5d2 100644 --- a/CocosDenshion/proj.nacl/Makefile +++ b/CocosDenshion/proj.nacl/Makefile @@ -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 $@ diff --git a/build-nacl.sh b/build-nacl.sh index f7dae2650a..c5fdeb2250 100755 --- a/build-nacl.sh +++ b/build-nacl.sh @@ -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 diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile index d8929ba28b..c7b2352140 100644 --- a/cocos2dx/proj.linux/Makefile +++ b/cocos2dx/proj.linux/Makefile @@ -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 $@ - diff --git a/cocos2dx/proj.nacl/Makefile b/cocos2dx/proj.nacl/Makefile index 04cb968aed..a59a264802 100644 --- a/cocos2dx/proj.nacl/Makefile +++ b/cocos2dx/proj.nacl/Makefile @@ -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 $@ diff --git a/cocos2dx/proj.nacl/cocos2dx.mk b/cocos2dx/proj.nacl/cocos2dx.mk index a9f6881af7..bcdba69908 100644 --- a/cocos2dx/proj.nacl/cocos2dx.mk +++ b/cocos2dx/proj.nacl/cocos2dx.mk @@ -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 diff --git a/extensions/proj.nacl/Makefile b/extensions/proj.nacl/Makefile index d044f3ac4b..b0b56e6276 100644 --- a/extensions/proj.nacl/Makefile +++ b/extensions/proj.nacl/Makefile @@ -40,3 +40,7 @@ EXTENSIONS_SOURCES = ../CCBReader/CCBFileLoader.cpp \ ../GUI/CCControlExtension/CCControlStepper.cpp \ ../physics_nodes/CCPhysicsDebugNode.cpp \ ../physics_nodes/CCPhysicsSprite.cpp + +all: + +clean: diff --git a/external/Box2D/proj.nacl/Makefile b/external/Box2D/proj.nacl/Makefile index f9b20cb4e9..5e1502f9e9 100644 --- a/external/Box2D/proj.nacl/Makefile +++ b/external/Box2D/proj.nacl/Makefile @@ -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 $@ diff --git a/external/chipmunk/proj.nacl/Makefile b/external/chipmunk/proj.nacl/Makefile index 3ef390af96..22c4a93d07 100644 --- a/external/chipmunk/proj.nacl/Makefile +++ b/external/chipmunk/proj.nacl/Makefile @@ -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 $@ diff --git a/samples/Cpp/HelloCpp/proj.nacl/Makefile b/samples/Cpp/HelloCpp/proj.nacl/Makefile index 407d5d2b39..1f11c53653 100644 --- a/samples/Cpp/HelloCpp/proj.nacl/Makefile +++ b/samples/Cpp/HelloCpp/proj.nacl/Makefile @@ -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 diff --git a/samples/Cpp/SimpleGame/proj.nacl/Makefile b/samples/Cpp/SimpleGame/proj.nacl/Makefile index a94774229a..aa61e6bd57 100644 --- a/samples/Cpp/SimpleGame/proj.nacl/Makefile +++ b/samples/Cpp/SimpleGame/proj.nacl/Makefile @@ -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 diff --git a/samples/Cpp/TestCpp/proj.nacl/Makefile b/samples/Cpp/TestCpp/proj.nacl/Makefile index 25e8784f08..c06d5c65d9 100644 --- a/samples/Cpp/TestCpp/proj.nacl/Makefile +++ b/samples/Cpp/TestCpp/proj.nacl/Makefile @@ -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 diff --git a/samples/Cpp/TestCpp/proj.nacl/main.cpp b/samples/Cpp/TestCpp/proj.nacl/main.cpp index 771d0d356a..8c71805226 100644 --- a/samples/Cpp/TestCpp/proj.nacl/main.cpp +++ b/samples/Cpp/TestCpp/proj.nacl/main.cpp @@ -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", diff --git a/samples/Lua/HelloLua/proj.nacl/Makefile b/samples/Lua/HelloLua/proj.nacl/Makefile index f4eacf6ff2..ac67d2af41 100644 --- a/samples/Lua/HelloLua/proj.nacl/Makefile +++ b/samples/Lua/HelloLua/proj.nacl/Makefile @@ -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 diff --git a/samples/Lua/TestLua/proj.nacl/Makefile b/samples/Lua/TestLua/proj.nacl/Makefile index 9fe74fcf21..68ac972584 100644 --- a/samples/Lua/TestLua/proj.nacl/Makefile +++ b/samples/Lua/TestLua/proj.nacl/Makefile @@ -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 diff --git a/samples/Lua/TestLua/proj.nacl/main.cpp b/samples/Lua/TestLua/proj.nacl/main.cpp index 0daec1d666..da3cad3e64 100644 --- a/samples/Lua/TestLua/proj.nacl/main.cpp +++ b/samples/Lua/TestLua/proj.nacl/main.cpp @@ -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", diff --git a/scripting/lua/proj.nacl/Makefile b/scripting/lua/proj.nacl/Makefile index 8375bb1b5e..0245dba158 100644 --- a/scripting/lua/proj.nacl/Makefile +++ b/scripting/lua/proj.nacl/Makefile @@ -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 $@