From a83b6a6261319424db80c094a02c1d57c5c8c7d7 Mon Sep 17 00:00:00 2001 From: Byung Choi Date: Fri, 21 Sep 2012 15:35:41 +0900 Subject: [PATCH] updated sample/helloCpp debug & release makefile for linux --- make-all-linux-project.sh | 9 ++++--- samples/HelloCpp/proj.linux/Makefile | 36 +++++++++++++++++++--------- samples/HelloCpp/proj.linux/main.cpp | 2 +- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/make-all-linux-project.sh b/make-all-linux-project.sh index 166f472e92..fd421a442e 100755 --- a/make-all-linux-project.sh +++ b/make-all-linux-project.sh @@ -107,6 +107,9 @@ make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux clean make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux release check_make_result -#make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux clean -#make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux -#check_make_result +make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux debug +check_make_result +make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/HelloCpp/proj.linux release +check_make_result diff --git a/samples/HelloCpp/proj.linux/Makefile b/samples/HelloCpp/proj.linux/Makefile index 03df0db1f1..581d1700e3 100644 --- a/samples/HelloCpp/proj.linux/Makefile +++ b/samples/HelloCpp/proj.linux/Makefile @@ -1,8 +1,8 @@ CC = gcc CXX = g++ TARGET = HelloCpp -CCFLAGS = -Wall -g -O2 -CXXFLAGS = -Wall -g -O2 +CCFLAGS = -Wall +CXXFLAGS = -Wall VISIBILITY = COCOS2DX_PATH = ../../../cocos2dx @@ -41,28 +41,42 @@ STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ $(STATICLIBS_DIR)/libtiff.a \ # $(STATICLIBS_DIR)/libGLEW.a \ - -SHAREDLIBS = -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/ -SHAREDLIBS += -lglfw -lcurl -SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib +SHAREDLIBS = -lglfw -lcurl +SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW #$(shell ../../build-linux.sh $<) -BIN_DIR=bin +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) - test -d $(BIN_DIR) || mkdir $(BIN_DIR) + mkdir -p $(BIN_DIR) $(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 - rm -r $(BIN_DIR) diff --git a/samples/HelloCpp/proj.linux/main.cpp b/samples/HelloCpp/proj.linux/main.cpp index f99af29189..74529cfc6d 100644 --- a/samples/HelloCpp/proj.linux/main.cpp +++ b/samples/HelloCpp/proj.linux/main.cpp @@ -24,7 +24,7 @@ int main(int argc, char **argv) std::string resourcePath = fullpath; resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); - resourcePath += "/../../Resources/"; + resourcePath += "/../../../Resources/"; // create the application instance AppDelegate app;