diff --git a/Makefile b/Makefile index 0e826214f9..f8c529b257 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ define MAKE_TARGET +$(MAKE) -C scripting/lua/proj.$(PLATFORM) $@ +$(MAKE) -C samples/Cpp/HelloCpp/proj.$(PLATFORM) $@ +$(MAKE) -C samples/Cpp/TestCpp/proj.$(PLATFORM) $@ + +$(MAKE) -C samples/Cpp/SimpleGame/proj.$(PLATFORM) $@ +$(MAKE) -C samples/Lua/HelloLua/proj.$(PLATFORM) $@ +$(MAKE) -C samples/Lua/TestLua/proj.$(PLATFORM) $@ endef diff --git a/cocos2dx/proj.linux/cocos2dx.mk b/cocos2dx/proj.linux/cocos2dx.mk index 455a9877d3..60a170031a 100644 --- a/cocos2dx/proj.linux/cocos2dx.mk +++ b/cocos2dx/proj.linux/cocos2dx.mk @@ -99,3 +99,16 @@ clean: rm -f $(TARGET) core .PHONY: all clean + +# 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 diff --git a/samples/Cpp/HelloCpp/proj.linux/Makefile b/samples/Cpp/HelloCpp/proj.linux/Makefile index 498439a7e0..178fa06a86 100644 --- a/samples/Cpp/HelloCpp/proj.linux/Makefile +++ b/samples/Cpp/HelloCpp/proj.linux/Makefile @@ -1,6 +1,6 @@ -TARGET = HelloCpp +EXECUTABLE = HelloCpp -INCLUDES = -I.. -I../Classes +INCLUDES = -I.. -I../Classes SOURCES = main.cpp \ ../Classes/AppDelegate.cpp \ @@ -12,10 +12,6 @@ include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk SHAREDLIBS += -lcocos2d COCOS_LIBS = $(LIB_DIR)/libcocos2d.so -TARGET := $(BIN_DIR)/$(TARGET) - -all: $(TARGET) - $(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) @mkdir -p $(@D) $(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) diff --git a/samples/Cpp/HelloCpp/proj.linux/main.cpp b/samples/Cpp/HelloCpp/proj.linux/main.cpp index 08245dd052..be615ef301 100644 --- a/samples/Cpp/HelloCpp/proj.linux/main.cpp +++ b/samples/Cpp/HelloCpp/proj.linux/main.cpp @@ -1,8 +1,6 @@ -#include "main.h" #include "../Classes/AppDelegate.h" #include "cocos2d.h" - #include #include #include diff --git a/samples/Cpp/HelloCpp/proj.linux/main.h b/samples/Cpp/HelloCpp/proj.linux/main.h deleted file mode 100644 index 952830d1ac..0000000000 --- a/samples/Cpp/HelloCpp/proj.linux/main.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__ diff --git a/samples/Cpp/SimpleGame/proj.linux/Makefile b/samples/Cpp/SimpleGame/proj.linux/Makefile new file mode 100644 index 0000000000..ecfd0d4986 --- /dev/null +++ b/samples/Cpp/SimpleGame/proj.linux/Makefile @@ -0,0 +1,27 @@ +EXECUTABLE = SimpleGame + +INCLUDES = -I.. -I../Classes + +SOURCES = main.cpp \ + ../Classes/AppDelegate.cpp \ + ../Classes/HelloWorldScene.cpp \ + ../Classes/GameOverScene.cpp + +COCOS_ROOT = ../../../.. +include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk + +SHAREDLIBS += -lcocos2d -lcocosdenshion +COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so +INCLUDES += -I$(COCOS_ROOT)/CocosDenshion/include + +$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) + +$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ + +$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ diff --git a/samples/Cpp/SimpleGame/proj.linux/main.cpp b/samples/Cpp/SimpleGame/proj.linux/main.cpp new file mode 100644 index 0000000000..fbaeec114b --- /dev/null +++ b/samples/Cpp/SimpleGame/proj.linux/main.cpp @@ -0,0 +1,20 @@ +#include "../Classes/AppDelegate.h" +#include "cocos2d.h" + +#include +#include +#include +#include + +USING_NS_CC; + +int main(int argc, char **argv) +{ + // create the application instance + AppDelegate app; + + CCEGLView* eglView = CCEGLView::sharedOpenGLView(); + eglView->setFrameSize(800, 480); + + return CCApplication::sharedApplication()->run(); +} diff --git a/samples/Cpp/TestCpp/proj.linux/Makefile b/samples/Cpp/TestCpp/proj.linux/Makefile index d7678cc539..a9346a7c3e 100644 --- a/samples/Cpp/TestCpp/proj.linux/Makefile +++ b/samples/Cpp/TestCpp/proj.linux/Makefile @@ -1,4 +1,4 @@ -TARGET = TestCpp +EXECUTABLE = TestCpp SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \ ../Classes/ActionManagerTest/ActionManagerTest.cpp \ @@ -111,9 +111,6 @@ STATICLIBS += \ DEFINES += -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -TARGET := $(BIN_DIR)/$(TARGET) -all: $(TARGET) - ####### Build rules $(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) @mkdir -p $(@D) diff --git a/samples/Cpp/TestCpp/proj.linux/main.cpp b/samples/Cpp/TestCpp/proj.linux/main.cpp index 21e3fc5d5c..bbaa8a6d23 100644 --- a/samples/Cpp/TestCpp/proj.linux/main.cpp +++ b/samples/Cpp/TestCpp/proj.linux/main.cpp @@ -1,5 +1,3 @@ -#include "main.h" - #include "../Classes/AppDelegate.h" #include "cocos2d.h" #include "CCEGLView.h" @@ -12,7 +10,7 @@ USING_NS_CC; int main(int argc, char **argv) -{ +{ // create the application instance AppDelegate app; CCEGLView* eglView = CCEGLView::sharedOpenGLView(); diff --git a/samples/Cpp/TestCpp/proj.linux/main.h b/samples/Cpp/TestCpp/proj.linux/main.h deleted file mode 100644 index 86022e430a..0000000000 --- a/samples/Cpp/TestCpp/proj.linux/main.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -//#include -//#include - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__ diff --git a/samples/Lua/HelloLua/proj.linux/Makefile b/samples/Lua/HelloLua/proj.linux/Makefile index 6e7a168d72..bfd502d2a4 100644 --- a/samples/Lua/HelloLua/proj.linux/Makefile +++ b/samples/Lua/HelloLua/proj.linux/Makefile @@ -1,4 +1,4 @@ -TARGET = HelloLua +EXECUTABLE = HelloLua COCOS_ROOT = ../../../.. INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \ @@ -11,13 +11,8 @@ SOURCES = main.cpp ../Classes/AppDelegate.cpp SHAREDLIBS += -lcocos2d -lcocosdenshion -llua COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so $(LIB_DIR)/liblua.so - include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk -TARGET := $(BIN_DIR)/$(TARGET) - -all: $(TARGET) - $(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) @mkdir -p $(@D) $(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) $(LIBS) diff --git a/samples/Lua/HelloLua/proj.linux/main.cpp b/samples/Lua/HelloLua/proj.linux/main.cpp index 9299d8ff3f..dd21672f23 100644 --- a/samples/Lua/HelloLua/proj.linux/main.cpp +++ b/samples/Lua/HelloLua/proj.linux/main.cpp @@ -1,8 +1,6 @@ -#include "main.h" #include "../Classes/AppDelegate.h" #include "cocos2d.h" - #include #include #include @@ -11,7 +9,7 @@ USING_NS_CC; int main(int argc, char **argv) -{ +{ // create the application instance AppDelegate app; CCEGLView* eglView = CCEGLView::sharedOpenGLView(); diff --git a/samples/Lua/HelloLua/proj.linux/main.h b/samples/Lua/HelloLua/proj.linux/main.h deleted file mode 100644 index 952830d1ac..0000000000 --- a/samples/Lua/HelloLua/proj.linux/main.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__ diff --git a/samples/Lua/TestLua/proj.linux/Makefile b/samples/Lua/TestLua/proj.linux/Makefile index de4aaf7654..5c298570ef 100644 --- a/samples/Lua/TestLua/proj.linux/Makefile +++ b/samples/Lua/TestLua/proj.linux/Makefile @@ -1,4 +1,4 @@ -TARGET = TestLua +EXECUTABLE = TestLua COCOS_ROOT = ../../../.. INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \ @@ -13,10 +13,6 @@ COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so $(LIB_DIR)/ include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk -TARGET := $(BIN_DIR)/$(TARGET) - -all: $(TARGET) - $(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) @mkdir -p $(@D) cp -R -n ../../../../samples/Cpp/TestCpp/Resources ../../../../samples/Lua/TestLua diff --git a/samples/Lua/TestLua/proj.linux/main.cpp b/samples/Lua/TestLua/proj.linux/main.cpp index c1ce114a4e..bbaa8a6d23 100644 --- a/samples/Lua/TestLua/proj.linux/main.cpp +++ b/samples/Lua/TestLua/proj.linux/main.cpp @@ -1,5 +1,3 @@ -#include "main.h" - #include "../Classes/AppDelegate.h" #include "cocos2d.h" #include "CCEGLView.h" @@ -12,7 +10,7 @@ USING_NS_CC; int main(int argc, char **argv) -{ +{ // create the application instance AppDelegate app; CCEGLView* eglView = CCEGLView::sharedOpenGLView(); diff --git a/samples/Lua/TestLua/proj.linux/main.h b/samples/Lua/TestLua/proj.linux/main.h deleted file mode 100644 index 86022e430a..0000000000 --- a/samples/Lua/TestLua/proj.linux/main.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -//#include -//#include - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__ diff --git a/template/multi-platform-cpp/proj.linux/Makefile b/template/multi-platform-cpp/proj.linux/Makefile index d3ccd8c0c1..1b851ad66a 100644 --- a/template/multi-platform-cpp/proj.linux/Makefile +++ b/template/multi-platform-cpp/proj.linux/Makefile @@ -1,101 +1,25 @@ -CC = gcc -CXX = g++ -TARGET = HelloCpp -CCFLAGS = -Wall -CXXFLAGS = -Wall -VISIBILITY = -LIBS = +EXECUTABLE = HelloCpp -COCOS2DX_PATH = ../../../cocos2dx -INCLUDES = -I../ \ - -I../../ \ - -I../Classes \ - -I$(COCOS2DX_PATH) \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libfreetype2 \ - -I$(COCOS2DX_PATH)/cocoa \ - -I$(COCOS2DX_PATH)/include \ - -I$(COCOS2DX_PATH)/kazmath/include \ - -I$(COCOS2DX_PATH)/platform \ - -I$(COCOS2DX_PATH)/platform/linux \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libxml2 \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libjpeg \ - -I../../../CocosDenshion/include \ - -I../../../extensions/ \ - -I../../../external/ \ - -I../../../external/chipmunk/include/chipmunk \ +INCLUDES = -I.. -I../Classes +SOURCES = main.cpp \ + ../Classes/AppDelegate.cpp \ + ../Classes/HelloWorldScene.cpp -LBITS := $(shell getconf LONG_BIT) -ifeq ($(LBITS),64) -INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux/include64 -else -INCLUDES += -I$(COCOS2DX_PATH)/platform/third_party/linux -endif +COCOS_ROOT = ../../.. +include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk -DEFINES = -DLINUX +SHAREDLIBS += -lcocos2d +COCOS_LIBS = $(LIB_DIR)/libcocos2d.so -OBJECTS = ../Classes/AppDelegate.o \ - ../Classes/HelloWorldScene.o \ - ./main.o +$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) -ifeq ($(LBITS),64) -STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 -else -STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries -endif -STATICLIBS = -STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ - $(STATICLIBS_DIR)/libcurl.a \ - $(STATICLIBS_DIR)/libxml2.a \ - $(STATICLIBS_DIR)/libpng.a \ - $(STATICLIBS_DIR)/libjpeg.a \ - $(STATICLIBS_DIR)/libtiff.a \ - ../../../lib/linux/Debug/libextension.a \ - ../../../lib/linux/Debug/libbox2d.a \ - ../../../lib/linux/Debug/libchipmunk.a +$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ -SHAREDLIBS = -ifeq ($(LBITS),64) -SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/lib64/api/lib -SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex64 -else -SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/api/lib -SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex -endif - -SHAREDLIBS += -Wl,-rpath,../../$(SHAREDLIBS_DIR) -SHAREDLIBS += -lglfw -lGLEW -lcurl - -BIN_DIR_ROOT=bin -BIN_DIR = BIN_DIR_ROOT - -debug: SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../../lib/linux/Debug -debug: CCFLAGS += -g3 -O0 -debug: CXXFLAGS += -g3 -O0 -debug: DEFINES += -DDEBUG -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -debug: BIN_DIR = $(BIN_DIR_ROOT)/debug -debug: $(TARGET) - -release: SHAREDLIBS += -L../../../lib/linux/Release -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../../lib/linux/Release -release: CCFLAGS += -O3 -release: CXXFLAGS += -O3 -release: DEFINES += -DNDEBUG -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -release: BIN_DIR = $(BIN_DIR_ROOT)/release -release: $(TARGET) - -####### Build rules -$(TARGET): $(OBJECTS) - mkdir -p $(BIN_DIR) - $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) $(LIBS) - - -####### Compile -%.o: %.cpp - $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ - -%.o: %.c - $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ - - -clean: - rm -f $(OBJECTS) $(TARGET) core +$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ diff --git a/template/multi-platform-cpp/proj.linux/main.cpp b/template/multi-platform-cpp/proj.linux/main.cpp index 21e3fc5d5c..bbaa8a6d23 100644 --- a/template/multi-platform-cpp/proj.linux/main.cpp +++ b/template/multi-platform-cpp/proj.linux/main.cpp @@ -1,5 +1,3 @@ -#include "main.h" - #include "../Classes/AppDelegate.h" #include "cocos2d.h" #include "CCEGLView.h" @@ -12,7 +10,7 @@ USING_NS_CC; int main(int argc, char **argv) -{ +{ // create the application instance AppDelegate app; CCEGLView* eglView = CCEGLView::sharedOpenGLView(); diff --git a/template/multi-platform-cpp/proj.linux/main.h b/template/multi-platform-cpp/proj.linux/main.h deleted file mode 100644 index 86022e430a..0000000000 --- a/template/multi-platform-cpp/proj.linux/main.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -//#include -//#include - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__ diff --git a/template/multi-platform-lua/proj.linux/Makefile b/template/multi-platform-lua/proj.linux/Makefile index 2daa2d70e9..3b28d2b9b3 100644 --- a/template/multi-platform-lua/proj.linux/Makefile +++ b/template/multi-platform-lua/proj.linux/Makefile @@ -1,93 +1,26 @@ -CC = gcc -CXX = g++ -TARGET = HelloLua -CCFLAGS = -Wall -CXXFLAGS = -Wall -VISIBILITY = +EXECUTABLE = HelloLua -COCOS2DX_PATH = ../../../cocos2dx -INCLUDES = -I../ \ - -I../Classes \ - -I$(COCOS2DX_PATH) \ - -I$(COCOS2DX_PATH)/platform/third_party/linux \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libfreetype2 \ - -I$(COCOS2DX_PATH)/cocoa \ - -I$(COCOS2DX_PATH)/include \ - -I$(COCOS2DX_PATH)/platform \ - -I$(COCOS2DX_PATH)/platform/linux \ - -I$(COCOS2DX_PATH)/kazmath/include \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libxml2 \ - -I$(COCOS2DX_PATH)/platform/third_party/linux/libjpeg \ - -I../../../CocosDenshion/include \ - -I../../../scripting/lua/lua \ - -I../../../scripting/lua/tolua \ - -I../../../scripting/lua/cocos2dx_support +COCOS_ROOT = ../../.. +INCLUDES = -I../ -I../Classes -I$(COCOS_ROOT)/CocosDenshion/include \ + -I$(COCOS_ROOT)/scripting/lua/lua \ + -I$(COCOS_ROOT)/scripting/lua/tolua \ + -I$(COCOS_ROOT)/scripting/lua/cocos2dx_support +SOURCES = main.cpp ../Classes/AppDelegate.cpp -DEFINES = -DLINUX +SHAREDLIBS += -lcocos2d -lcocosdenshion -llua +COCOS_LIBS = $(LIB_DIR)/libcocos2d.so $(LIB_DIR)/libcocosdenshion.so $(LIB_DIR)/liblua.so -OBJECTS = ./main.o \ - ../Classes/AppDelegate.o +include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk -LBITS := $(shell getconf LONG_BIT) -ifeq ($(LBITS),64) -STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 -else -STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries -endif +$(TARGET): $(OBJECTS) $(STATICLIBS) $(COCOS_LIBS) $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_LINK)$(CXX) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) $(LIBS) -STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ - $(STATICLIBS_DIR)/libcurl.a \ - $(STATICLIBS_DIR)/libxml2.a \ - $(STATICLIBS_DIR)/libpng.a \ - $(STATICLIBS_DIR)/libjpeg.a \ - $(STATICLIBS_DIR)/libtiff.a \ -# $(STATICLIBS_DIR)/libGLEW.a \ - ../../../lib/linux/Debug/libbox2d.a \ - ../../../lib/linux/Debug/libchipmunk.a +$(OBJ_DIR)/%.o: ../%.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ -SHAREDLIBS += -lglfw -lcurl -llua -lGLEW -SHAREDLIBS += -Wl,-rpath,../../../../lib/linux/Debug - -ifeq ($(LBITS),64) -SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/lib64/api/lib -lfmodex64 -Wl,-rpath,../../../../CocosDenshion/third_party/fmod/lib64/api/lib -else -SHAREDLIBS += -L../../../CocosDenshion/third_party/fmod/api/lib -lfmodex -Wl,-rpath,../../../../CocosDenshion/third_party/fmod/api/lib -endif - -#$(shell ../../build-linux.sh $<) - -BIN_DIR_ROOT=bin -BIN_DIR = $(BIN_DIR_ROOT) - -debug: BIN_DIR = $(BIN_DIR_ROOT)/debug -debug: CCFLAGS += -g3 -O0 -debug: CXXFLAGS += -g3 -O0 -debug: SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -debug: SHAREDLIBS += -Wl,-rpath,../../../../lib/linux/Debug/ -debug: DEFINES += -DDEBUG -debug: $(TARGET) - -release: BIN_DIR = $(BIN_DIR_ROOT)/release -release: CCFLAGS += -O3 -release: CXXFLAGS += -O3 -release: SHAREDLIBS += -L../../../lib/linux/Release -lcocos2d -lrt -lz -lcocosdenshion -release: SHAREDLIBS += -Wl,-rpath,../../../../lib/linux/Release/ -release: DEFINES += -DNDEBUG -release: $(TARGET) - -####### Build rules -$(TARGET): $(OBJECTS) - mkdir -p $(BIN_DIR) - cp -R -n ../../../samples/Cpp/TestCpp/Resources ../../../samples/Lua/HelloLua - $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) - -####### Compile -%.o: %.cpp - $(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ - -%.o: %.c - $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ - -clean: - rm -f $(OBJECTS) $(TARGET) core +$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST) + @mkdir -p $(@D) + $(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ diff --git a/template/multi-platform-lua/proj.linux/main.cpp b/template/multi-platform-lua/proj.linux/main.cpp index c1ce114a4e..bbaa8a6d23 100644 --- a/template/multi-platform-lua/proj.linux/main.cpp +++ b/template/multi-platform-lua/proj.linux/main.cpp @@ -1,5 +1,3 @@ -#include "main.h" - #include "../Classes/AppDelegate.h" #include "cocos2d.h" #include "CCEGLView.h" @@ -12,7 +10,7 @@ USING_NS_CC; int main(int argc, char **argv) -{ +{ // create the application instance AppDelegate app; CCEGLView* eglView = CCEGLView::sharedOpenGLView(); diff --git a/template/multi-platform-lua/proj.linux/main.h b/template/multi-platform-lua/proj.linux/main.h deleted file mode 100644 index 86022e430a..0000000000 --- a/template/multi-platform-lua/proj.linux/main.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __MAIN_H__ -#define __MAIN_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -//#include -//#include - -// C RunTime Header Files -#include "CCStdC.h" - -#endif // __MAIN_H__