diff --git a/Osmand-kernel/.gitignore b/Osmand-kernel/.gitignore index d49fd48ab4..0f5a5edfdc 100644 --- a/Osmand-kernel/.gitignore +++ b/Osmand-kernel/.gitignore @@ -1,2 +1,2 @@ -osmand_main +osmand_main* osm_out diff --git a/Osmand-kernel/Makefile.vars b/Osmand-kernel/Makefile.vars index f343f5b60d..9a25ad1082 100644 --- a/Osmand-kernel/Makefile.vars +++ b/Osmand-kernel/Makefile.vars @@ -10,7 +10,7 @@ ifeq ($(os),) os := darwin endif ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) - os := win + os := cygwin endif ifeq ($(findstring MINGW,$(shell uname)),MINGW) os := win @@ -31,24 +31,35 @@ endif # os=Default is meant to be generic unix/linux linux_CXX := g++ +linux_CC := gcc linux_STRIP := strip #Default_LINKFLAGS := -shared # Support10_4 := -isysroot /Developer/SDKs/MacOSX10.4u.sdk darwin_CXX := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4) +darwin_CC := gcc -arch $(arch) -mmacosx-version-min=10.4 $(Support10_4) darwin_STRIP := strip -x #darwin_CPP_FLAGS := strip -x #darwin_LINKFLAGS := -dynamiclib $(Support10_4) +# mingw32 via Cygwin OBSOLETE : i686-pc-mingw32- +# mingw64 via Cygwin : i686-w64-mingw32- +# gcc via Cygwin : i686-pc-cygwin- +# x86_64-w64-mingw32 +cygwin_CXX := i686-pc-cygwin-g++ +cygwin_CC := i686-pc-cygwin-gcc +cygwin_STRIP := i686-pc-cygwin-strip win_CXX := i586-mingw32msvc-gcc +win_CC := i586-mingw32msvc-gcc win_STRIP := i586-mingw32msvc-strip win_CPP_FLAGS := -D_Windows #win_CFLAGS := -D_JNI_IMPLEMENTATION_ -Ilib/inc_win -I$(JAVA_HOME)/include -O #win_LINKFLAGS := -Wl,--kill-at -shared CXX := $($(os)_CXX) +CC := $($(os)_CC) STRIP := $($(os)_STRIP) CPP_OS_FLAGS = $($(os)_CPP_FLAGS) #LINKFLAGS := $($(os)_LINKFLAGS) \ No newline at end of file diff --git a/Osmand-kernel/expat/Makefile b/Osmand-kernel/expat/Makefile index 63a6ed1631..77c2a7a4d5 100644 --- a/Osmand-kernel/expat/Makefile +++ b/Osmand-kernel/expat/Makefile @@ -4,14 +4,15 @@ include Common.mk CPP_FILE_EXTENSION = c LIBNAME := libexpat.a -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) -CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) +CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) -Iexpat_library target : $(PREBUILT_DIR)/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) - cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBNAME) $(PREBUILT_DIR) build/$(LIBNAME): $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS) diff --git a/Osmand-kernel/freetype/Makefile b/Osmand-kernel/freetype/Makefile index 16c2bc2000..4e38e36cbe 100644 --- a/Osmand-kernel/freetype/Makefile +++ b/Osmand-kernel/freetype/Makefile @@ -4,7 +4,7 @@ include Common.mk CPP_FILE_EXTENSION = c LIBNAME := libft2.a -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) @@ -12,7 +12,8 @@ CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) target : $(PREBUILT_DIR)/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) - cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBNAME) $(PREBUILT_DIR) build/$(LIBNAME): $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS) diff --git a/Osmand-kernel/jni-prebuilt/.gitignore b/Osmand-kernel/jni-prebuilt/.gitignore index d64226320d..c96a04f008 100644 --- a/Osmand-kernel/jni-prebuilt/.gitignore +++ b/Osmand-kernel/jni-prebuilt/.gitignore @@ -1,6 +1,2 @@ -x86/ -armeabi/ -armeabi-v7a/ -linux-x86/ -win-x86/ -darwin-x86/ +* +!.gitignore \ No newline at end of file diff --git a/Osmand-kernel/osmand/Makefile b/Osmand-kernel/osmand/Makefile index 72354e0295..75a34e7191 100644 --- a/Osmand-kernel/osmand/Makefile +++ b/Osmand-kernel/osmand/Makefile @@ -1,7 +1,7 @@ LOCAL_PATH := . include ../Makefile.vars include ./Common.mk -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) LIBNAME := osmand.lib LIBOSNAME := osmand-$(os)-$(arch).lib @@ -11,7 +11,7 @@ LOCAL_SRC_FILES += src/osmand_main.cpp #LDFLAGS = -Wl,--hash-style=both -fPIC LDFLAGS = -Wall -fPIC -Wl,-Bsymbolic -LDRUNFLAGS = -Wl,--hash-style=both +#LDRUNFLAGS = -Wl,--hash-style=both # --trace -Bsymbolic -Bsymbolic-functions LDLIBS = -L$(PREBUILT_DIR) -lskia -lproto -lpthread -lrt -lft2 -lexpat -lpng -lz @@ -20,12 +20,30 @@ OBJECTS = $(LOCAL_SRC_FILES:src/%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/ C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) +ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) + FIXED_JAVA_HOME := $(shell cygpath -u "$(JAVA_HOME)") +else + FIXED_JAVA_HOME := $(JAVA_HOME) +endif + +ifeq ($(java_os),) + ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) + java_os := linux + endif + ifeq ($(findstring MINGW,$(shell uname)),MINGW) + java_os := win32 + endif +endif +ifeq ($(os),) + java_os := linux +endif + CPPFLAGS := \ -DGOOGLE_PROTOBUF_NO_RTTI \ -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \ -DSK_RELEASE \ -DGR_RELEASE=1 \ - -c -fPIC -I$(JAVA_HOME)/include \ + -c -fPIC -I"$(FIXED_JAVA_HOME)/include" -I"$(FIXED_JAVA_HOME)/include/$(java_os)" \ -DHASH_MAP_GNU \ $(C_INCLUDES) @@ -33,14 +51,13 @@ CPPFLAGS := \ #target : $(PREBUILT_DIR)/$(LIBNAME) target : $(PREBUILT_DIR)/$(LIBNAME) ../$(RUNFILE) - ../$(RUNFILE) : $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile $(CXX) $(LDRUNFLAGS) -o ../$(RUNFILE) $(OBJECTS) $(LDLIBS) @chmod +x ../$(RUNFILE) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBOSNAME) - cp build/$(LIBOSNAME) $(PREBUILT_DIR)/$(LIBNAME) - + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBOSNAME) $(PREBUILT_DIR) build/$(LIBOSNAME): $(OBJECTS) $(PREBUILT_DIR)/libskia.a $(PREBUILT_DIR)/libproto.a Makefile $(CXX) -shared -o build/$(LIBOSNAME) $(OBJECTS) $(LDFLAGS) $(LDLIBS) diff --git a/Osmand-kernel/png/Makefile b/Osmand-kernel/png/Makefile index 149ea14ea2..c223160ff6 100644 --- a/Osmand-kernel/png/Makefile +++ b/Osmand-kernel/png/Makefile @@ -4,7 +4,7 @@ include Common.mk CPP_FILE_EXTENSION = c LIBNAME := libpng.a -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) C_INCLUDES := $(addprefix -I, $(LOCAL_C_INCLUDES)) CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) @@ -12,14 +12,15 @@ CPPFLAGS = $(LOCAL_CFLAGS) $(C_INCLUDES) $(CPP_OS_FLAGS) target : $(PREBUILT_DIR)/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) - cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBNAME) $(PREBUILT_DIR) build/$(LIBNAME): $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS) build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES) @mkdir -p `dirname $@` - $(CXX) -o $@ -c $*.$(CPP_FILE_EXTENSION) $(CPPFLAGS) + $(CC) -o $@ -c $*.$(CPP_FILE_EXTENSION) $(CPPFLAGS) clean: $(RM) $(OBJECTS) build/$(LIBNAME) \ No newline at end of file diff --git a/Osmand-kernel/protobuf/Makefile b/Osmand-kernel/protobuf/Makefile index 64330c05ee..8d1d720424 100644 --- a/Osmand-kernel/protobuf/Makefile +++ b/Osmand-kernel/protobuf/Makefile @@ -3,7 +3,7 @@ include Common.mk CPP_FILE_EXTENSION = cc LIBNAME := libproto.a -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj-$(os)-$(arch)/%.o) CPPFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI -I. -fPIC LDLIBS = -lpthread @@ -11,7 +11,8 @@ LDLIBS = -lpthread target : $(PREBUILT_DIR)/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) - cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBNAME) $(PREBUILT_DIR) build/$(LIBNAME): $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS) diff --git a/Osmand-kernel/skia/Makefile b/Osmand-kernel/skia/Makefile index 3b44e71221..64884ffbe6 100644 --- a/Osmand-kernel/skia/Makefile +++ b/Osmand-kernel/skia/Makefile @@ -2,7 +2,7 @@ LOCAL_PATH = . include ../Makefile.vars include Common.mk -PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch)/ +PREBUILT_DIR = ../jni-prebuilt/$(os)-$(arch) LIBNAME := libskia.a CPP_FILE_EXTENSION = cpp @@ -31,18 +31,19 @@ CPPFLAGS := -DSK_RELEASE \ -fno-rtti \ -fno-exceptions \ -fPIC \ + -DSK_BUILD_FOR_UNIX \ $(C_INCLUDES) LDLIBS = -lpthread target : $(PREBUILT_DIR)/$(LIBNAME) -$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) - cp build/$(LIBNAME) $(PREBUILT_DIR)/$(LIBNAME) +$(PREBUILT_DIR)/$(LIBNAME) : build/$(LIBNAME) + mkdir -p $(PREBUILT_DIR) + cp build/$(LIBNAME) $(PREBUILT_DIR) build/$(LIBNAME): $(OBJECTS) ar -rf build/$(LIBNAME) $(OBJECTS) - cp build/$(LIBNAME) ../jni-prebuilt/linux-x86/$(LIBNAME) build/obj-$(os)-$(arch)/%.o : %.$(CPP_FILE_EXTENSION) $(LOCAL_C_INCLUDES) @mkdir -p `dirname $@`