OsmAnd/Osmand-kernel/Makefile.vars

155 lines
4.2 KiB
Text
Raw Normal View History

2012-06-21 06:24:17 +02:00
# Autodetermine target if not set
ifeq ($(TARGET),)
ifeq ($(shell uname),Darwin)
TARGET := darwin
else ifeq ($(shell uname),Linux)
TARGET := linux
else ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
TARGET := windows
else ifeq ($(findstring MINGW,$(shell uname)),MINGW)
TARGET := windows
endif
2012-06-04 23:49:39 +02:00
endif
2012-06-05 09:30:57 +02:00
2012-06-04 23:49:39 +02:00
############################################
2012-06-21 06:24:17 +02:00
# Google NaCl target
2012-06-04 09:13:33 +02:00
ifeq ($(TARGET),nacl)
ifndef NACL_SDK_ROOT
$(error Set NACL_SDK_ROOT environment variable)
endif
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
NACL_SDK_ROOT := $(shell cygpath -u "$(NACL_SDK_ROOT)")
endif
2012-06-21 06:24:17 +02:00
OSNAME := $(shell python $(NACL_SDK_ROOT)/tools/getos.py)
NACL_TOOLCHAIN := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX := $(NACL_TOOLCHAIN)/bin/i686-nacl-g++
CC := $(NACL_TOOLCHAIN)/bin/i686-nacl-gcc
AR := $(NACL_TOOLCHAIN)/bin/i686-nacl-ar
STATICLIB_EXT := a
DYNAMICLIB_EXT := nexe
LIBRARY_PREFIX := lib
LDLIBS += -lppapi_cpp -lppapi
GLOBAL_INCLUDES := -I../zlib/zlib_library -I$(NACL_TOOLCHAIN)/i686-nacl/usr/include
ZLIB_BUILD := defined
2012-06-21 07:39:01 +02:00
CFLAGS += -D__int64="long long"
2012-06-21 06:24:17 +02:00
CXXFLAGS += -D__int64="long long" -std=gnu++0x
DYNAMICLIB_FLAGS := -shared
############################################
# MacOSX/Darwin target
else ifeq ($(TARGET),darwin)
MACOSX_TOOLCHAIN_ROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer
MACOSX_SDK := $(IOS_TOOLCHAIN_ROOT)/SDKs/MacOSX10.6.sdk/
ifeq ($(JAVA_HOME),)
JAVA_HOME = /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers
endif
# Skia on Darwin supports only i386
ARCH := i386
CXXFLAGS += -arch $(ARCH)
CFLAGS += -arch $(ARCH)
CXX := /usr/bin/g++
CC := /usr/bin/gcc
AR := /usr/bin/ar
GLOBAL_INCLUDES := -I../zlib/zlib_library
ZLIB_BUILD := defined
STATICLIB_EXT := a
DYNAMICLIB_EXT := dylib
LIBRARY_PREFIX := lib
DYNAMICLIB_FLAGS := -dynamiclib
############################################
# iOS target
else ifeq ($(TARGET),ios)
IOS_TOOLCHAIN_ROOT := /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
IOS_SDK := $(IOS_TOOLCHAIN_ROOT)/SDKs/iPhoneOS5.1.sdk/
ifeq ($(ARCH),)
ARCH := armv6
endif
2012-05-15 20:48:06 +02:00
2012-06-21 06:24:17 +02:00
CXX := $(IOS_TOOLCHAIN_ROOT)/usr/bin/arm-apple-darwin10-llvm-g++-4.2
CC := $(IOS_TOOLCHAIN_ROOT)/usr/bin/arm-apple-darwin10-llvm-gcc-4.2
AR := $(IOS_TOOLCHAIN_ROOT)/usr/bin/ar
GLOBAL_INCLUDES := -I../zlib/zlib_library
ZLIB_BUILD := defined
STATICLIB_EXT := a
DYNAMICLIB_EXT := dylib
LIBRARY_PREFIX := lib
CXXFLAGS += -isysroot $(IOS_SDK)
CFLAGS += -isysroot $(IOS_SDK)
DYNAMICLIB_FLAGS := -dynamiclib
LDFLAGS := # empty
# -arch armv6
2012-06-04 23:49:39 +02:00
############################################
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
2012-06-21 06:24:17 +02:00
else
2012-06-04 23:49:39 +02:00
2012-06-21 06:24:17 +02:00
# Just don't ask
ifndef JAVA_HOME
$(error Set JAVA_HOME environment variable)
2012-05-15 20:48:06 +02:00
endif
2012-06-21 06:24:17 +02:00
############################################
# Windows via MinGW/Linux and MinGW/Cygwin target
ifeq ($(TARGET),windows)
CXX := i686-w64-mingw32-g++
CC := i686-w64-mingw32-gcc
AR := i686-w64-mingw32-ar
GLOBAL_INCLUDES := -I../zlib/zlib_library
ZLIB_BUILD := defined
STATICLIB_EXT := lib
DYNAMICLIB_EXT := dll
LIBRARY_PREFIX := # empty
LDFLAGS += -Wl,--kill-at -static-libstdc++ -static-libgcc
2012-06-21 07:39:01 +02:00
CFLAGS += # empty
2012-06-21 06:24:17 +02:00
CXXFLAGS += -std=gnu++0x
DYNAMICLIB_FLAGS := -shared
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
# Latest MinGW compiler under Cygwin needs this
CFLAGS += -D__int64="long long"
CXXFLAGS += -D__int64="long long"
endif
###########################################
# Default target
else
STATICLIB_EXT := a
DYNAMICLIB_EXT := so
LIBRARY_PREFIX := lib
2012-10-26 19:13:57 +02:00
DYNAMICLIB_FLAGS := -shared -Wl,--dynamic-list-cpp-new
2012-06-21 07:39:01 +02:00
CFLAGS += # empty
2012-06-21 06:24:17 +02:00
CXXFLAGS += -std=gnu++0x
2012-05-15 20:48:06 +02:00
endif
2012-06-21 06:24:17 +02:00
2012-05-15 20:48:06 +02:00
endif
2012-06-04 23:49:39 +02:00
2012-06-21 06:24:17 +02:00
2012-06-04 23:49:39 +02:00
############################################
2012-06-21 06:24:17 +02:00
# CPU architectures support
# Make default definitions
ifeq ($(ARCH),)
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
2012-06-21 06:24:17 +02:00
# Cygwin returns 'unknown'
ARCH := i386
else
ARCH := $(shell uname -i)
ifeq ($(ARCH),unknown)
ARCH := $(shell uname -m)
endif
endif
2012-06-04 09:13:33 +02:00
endif
2012-06-21 06:24:17 +02:00
# Modify compiler flags
2012-06-18 21:19:51 +02:00
ifeq ($(ARCH),i386)
2012-10-26 19:13:57 +02:00
CFLAGS += -m32 -fPIC
CXXFLAGS += -m32 -fPIC
LDFLAGS += -m32 -fPIC
2012-06-18 21:19:51 +02:00
else ifeq ($(ARCH),x86_64)
2012-07-11 21:34:59 +02:00
CFLAGS += -m64 -fPIC
CXXFLAGS += -m64 -fPIC
LDFLAGS += -m64 -fPIC
2012-06-21 06:24:17 +02:00
else ifeq ($(ARCH),armv6)
2012-06-18 21:19:51 +02:00
else
2012-06-21 06:24:17 +02:00
$(error Undefined ARCH $(ARCH))
2012-06-04 23:49:39 +02:00
endif