diff --git a/make-all-linux-project.sh b/make-all-linux-project.sh index 6fb94bc783..166f472e92 100755 --- a/make-all-linux-project.sh +++ b/make-all-linux-project.sh @@ -51,10 +51,12 @@ if ! test -d $DIR_GLEW170/glew-1.7.0/; then fi fi -OUTPUT_DEBUG=$COCOS2DX20_TRUNK/lib/linux/Debug/ -if ! test -d $OUTPUT_DEBUG; then - mkdir $OUTPUT_DEBUG -p -fi +#OUTPUT_DEBUG=$COCOS2DX20_TRUNK/lib/linux/Debug/ +#if ! test -d $OUTPUT_DEBUG; then +# mkdir $OUTPUT_DEBUG -p +#fi +mkdir -p $OUTPUT_DEBUG +mkdir -p $OUTPUT_RELEASE make -C $COCOS2DX20_TRUNK/external/Box2D/proj.linux clean make -C $COCOS2DX20_TRUNK/external/Box2D/proj.linux debug @@ -98,9 +100,13 @@ make -C $COCOS2DX20_TRUNK/CocosDenshion/proj.linux release check_make_result cp $COCOS2DX20_TRUNK/CocosDenshion/proj.linux/libcocosdenshion.so $OUTPUT_RELEASE -#make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux clean -#make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux -#check_make_result +make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux clean +make -C $COCOS2DX20_TRUNK/samples/TestCpp/proj.linux debug +check_make_result +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 diff --git a/samples/TestCpp/proj.linux/Makefile b/samples/TestCpp/proj.linux/Makefile index 67cdce1d3a..42ffefbb3b 100644 --- a/samples/TestCpp/proj.linux/Makefile +++ b/samples/TestCpp/proj.linux/Makefile @@ -1,8 +1,8 @@ CC = gcc CXX = g++ TARGET = TestCpp -CCFLAGS = -Wall -g #-O2 -CXXFLAGS = -Wall -g #-O2 +CCFLAGS = -Wall +CXXFLAGS = -Wall VISIBILITY = LIBS = @@ -120,7 +120,7 @@ OBJECTS = ../Classes/AccelerometerTest/AccelerometerTest.o \ ../Classes/AppDelegate.o \ ./main.o - + LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) STATICLIBS_DIR = ../../../cocos2dx/platform/third_party/linux/libraries/lib64 @@ -136,7 +136,6 @@ STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \ $(STATICLIBS_DIR)/libtiff.a \ ../../../lib/linux/Debug/libbox2d.a \ ../../../lib/linux/Debug/libchipmunk.a \ -# $(STATICLIBS_DIR)/libGLEW.a \ SHAREDLIBS = ifeq ($(LBITS),64) @@ -148,20 +147,36 @@ SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex endif SHAREDLIBS += -lglfw -lGL -#SHAREDLIBS += -lGLEW -SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/ -SHAREDLIBS += -Wl,-rpath,../$(SHAREDLIBS_DIR) -SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib +#SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/ +SHAREDLIBS += -Wl,-rpath,../../$(SHAREDLIBS_DIR) +#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 +SHAREDLIBS += -Wl,-rpath,../../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib + SHAREDLIBS += -Wl,-rpath,../$(STATICLIBS_DIR) SHAREDLIBS += -lcurl -BIN_DIR=bin +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 +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 +release: BIN_DIR = $(BIN_DIR_ROOT)/release +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) $(LIBS) @@ -171,8 +186,7 @@ $(TARGET): $(OBJECTS) %.o: %.c $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ - + clean: rm -f $(OBJECTS) $(TARGET) core - rm -r $(BIN_DIR) diff --git a/samples/TestCpp/proj.linux/main.cpp b/samples/TestCpp/proj.linux/main.cpp index f882a2cc66..71776a9eba 100644 --- a/samples/TestCpp/proj.linux/main.cpp +++ b/samples/TestCpp/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;