From 077d52599c5572b9f36c514c2a43f032caadf657 Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Tue, 29 Mar 2011 23:23:12 +0900 Subject: [PATCH] add -static-libgcc flag. This flag is necessary to remove the dependency to lib-gcc --- Makefile | 6 ++++++ Makefile.common | 36 +++++++++++++++++++----------------- devnote.txt | 4 +++- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 369ba30..ad52e70 100755 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ include Makefile.common +all: snappy SNAPPY_ARCHIVE:=$(TARGET)/snappy-$(VERSION).tar.gz @@ -36,3 +37,8 @@ $(SNAPPY_OUT)/%.o : $(SRC)/org/xerial/snappy/SnappyNative.cpp $(SNAPPY_OUT)/$(LIBNAME): $(SNAPPY_OBJ) $(CXX) $(CXXFLAGS) $(LINKFLAGS) -o $@ $* $(STRIP) $@ + +clean-native: + rm -rf $(SNAPPY_OBJ) $(SNAPPY_OUT)/$(LIBNAME) + + diff --git a/Makefile.common b/Makefile.common index ba2b14e..3344cf7 100755 --- a/Makefile.common +++ b/Makefile.common @@ -50,50 +50,52 @@ endif Default_CXX := g++ Default_STRIP := strip -Default_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC -Default_LINKFLAGS := -shared +Default_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC +Default_LINKFLAGS := -shared -static-libgcc Default_LIBNAME := libsnappy.so Default_SNAPPY_FLAGS := Linux-i386_CXX := g++ Linux-i386_STRIP := strip -Linux-i386_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC -Linux-i386_LINKFLAGS := -shared +Linux-i386_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC +Linux-i386_LINKFLAGS := -shared -static-libgcc Linux-i386_LIBNAME := libsnappy.so Linux-i386_SNAPPY_FLAGS:= Linux-amd64_CXX := g++ Linux-amd64_STRIP := strip -Linux-amd64_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -Os -fPIC -Linux-amd64_LINKFLAGS := -shared +Linux-amd64_CXXFLAGS := -I$(JAVA_HOME)/include -Ilib/inc_mac -O2 -fPIC +Linux-amd64_LINKFLAGS := -shared -static-libgcc Linux-amd64_LIBNAME := libsnappy.so Linux-amd64_SNAPPY_FLAGS := Mac-i386_CXX := g++ -arch $(OS_ARCH) Mac-i386_STRIP := strip -x -Mac-i386_CXXFLAGS := -I$(JAVA_HOME)/include -Os -fPIC -Mac-i386_LINKFLAGS := -dynamiclib +Mac-i386_CXXFLAGS := -I$(JAVA_HOME)/include -O2 -fPIC +Mac-i386_LINKFLAGS := -dynamiclib -static-libgcc Mac-i386_LIBNAME := libsnappy.jnilib Mac-i386_SNAPPY_FLAGS := Mac-x86_64_CXX := g++ -arch $(OS_ARCH) Mac-x86_64_STRIP := strip -x -Mac-x86_64_CXXFLAGS := -I$(JAVA_HOME)/include -Os -fPIC -Mac-x86_64_LINKFLAGS := -dynamiclib -Mac-x86_64_LIBNAME := libsnappy.jnilib +Mac-x86_64_CXXFLAGS := -I$(JAVA_HOME)/include -O2 -fPIC +Mac-x86_64_LINKFLAGS := -dynamiclib -static-libgcc +Mac-x86_64_LIBNAME := libsnappy.jnilib Mac-x86_64_SNAPPY_FLAGS := Windows-x86_CXX := mingw32-g++ Windows-x86_STRIP := strip -Windows-x86_CXXFLAGS := -Ilib/inc_win -O -Windows-x86_LINKFLAGS := -Wl,--kill-at -shared +Windows-x86_CXXFLAGS := -Ilib/inc_win -O2 +Windows-x86_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc Windows-x86_LIBNAME := snappy.dll Windows-x86_SNAPPY_FLAGS := Windows-amd64_CXX := x86_64-w64-mingw32-g++ Windows-amd64_STRIP := x86_64-w64-mingw32-strip -Windows-amd64_CXXFLAGS := -Ilib/inc_win -O -Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared +#Windows-amd64_CXX := g++ +#Windows-amd64_STRIP := strip +Windows-amd64_CXXFLAGS := -Ilib/inc_win -O2 +Windows-amd64_LINKFLAGS := -Wl,--kill-at -shared -static-libgcc Windows-amd64_LIBNAME := snappy.dll Windows-amd64_SNAPPY_FLAGS := @@ -105,9 +107,9 @@ LINKFLAGS := $($(os_arch)_LINKFLAGS) LIBNAME := $($(os_arch)_LIBNAME) SNAPPY_FLAGS := $($(os_arch)_SNAPPY_FLAGS) -SNAPPY_OUT:=$(TARGET)/$(snappy)/$(os_arch) +SNAPPY_OUT:=$(TARGET)/$(snappy)-$(os_arch) -CXXFLAGS := $(CXXFLAGS) -I$(SNAPPY_OUT) -I$(SNAPPY_SRC) +CXXFLAGS := $(CXXFLAGS) -I$(SNAPPY_OUT) -I$(SNAPPY_SRC) ifneq ($(jni_include),) CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)" endif diff --git a/devnote.txt b/devnote.txt index 9bcf73a..bd20f71 100755 --- a/devnote.txt +++ b/devnote.txt @@ -5,4 +5,6 @@ mingwin compile --static-libgcc + +make snappy CXX=/cygdrive/c/MinGW/bin/g++ +