OsmAnd/Osmand-kernel/Makefile.vars
2012-06-05 09:31:24 +02:00

114 lines
2.9 KiB
Text

ifndef $(ARCH)
ARCH := x86
endif
############################################
############# NACL ### TARGET
ifeq ($(TARGET),nacl)
ifndef NACL_SDK_ROOT
$(error Set NACL_SDK_ROOT environment variable)
endif
#
# Disable DOS PATH warning when using Cygwin based tools Windows
#
CYGWIN ?= nodosfilewarning
export CYGWIN
OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py)
# Turns on warnings (-Wxxx), builds with zero optimization (-O0) and adds debug
# information (-g) for correctness and ease of debugging.
WARNINGS:=-Wno-long-long -Wall
TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CFLAGS:=-pthread $(WARNINGS)
CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
CC:=$(TC_PATH)/bin/i686-nacl-gcc
STATICLIB_EXT := a
DYNAMICLIB_EXT := nexe
LIBRARY_PREFIX := lib
LDFLAGS := -lppapi_cpp -lppapi
GLOBAL_INCLUDES=-I../zlib/zlib_library -I$(TC_PATH)/i686-nacl/usr/include
RT_NOT_SUPPORTED := defined
ZLIB_BUILD := defined
ifeq ($(ARCH),x86)
CFLAGS += -m32
CXXFLAGS += -m32
LDFLAGS += -m32
else ifeq ($(ARCH),x64)
CFLAGS += -m64
CXXFLAGS += -m64
LDFLAGS += -m64
else
$(error Undefined ARCH $(ARCH))
endif
else
############################################
### EVERYTHING ELSE REQUIRES JAVA_HOME #####
ifndef JAVA_HOME
$(error Set JAVA_HOME environment variable)
endif
ifeq ($(TARGET),)
ifeq ($(shell uname),Darwin)
TARGET := darwin
endif
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
TARGET := cygwin
endif
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
TARGET := win
endif
endif
############################################
####### DEFAULT LINUX ########## TARGET
CXX := g++
CC := gcc
STRIP := strip
STATICLIB_EXT := a
DYNAMICLIB_EXT := so
LIBRARY_PREFIX := lib
LDFLAGS := -shared -Wl,-Bsymbolic
############################################
####### Windows ########## TARGET
ifeq ($(TARGET),win)
CXX := i586-mingw32msvc-gcc
CC := i586-mingw32msvc-gcc
STRIP := i586-mingw32msvc-strip
WINDRES :=i586-mingw32msvc-windres
RANLIB := i586-mingw32msvc-ranlib
WINDRES := i586-mingw32msvc-windres
AR := i586-mingw32msvc-ar
GLOBAL_INCLUDES := -I../pthread/pthreads_library -I../zlib/zlib_library
RT_NOT_SUPPORTED := defined
ZLIB_BUILD := defined
PTHREAD_BUILD := defined
COMMONFLAGS := -D_Windows -DXMD_H -DHAVE_BOOLEAN -DRT_NOT_SUPPORTED
CPP_FLAGS := $(COMMONFLAGS)
CFLAGS := -D_JNI_IMPLEMENTATION $(COMMONFLAGS)
STATICLIB_EXT := a
DYNAMICLIB_EXT := dll
LIBRARY_PREFIX := lib
LDFLAGS := -shared -Wl,-Bsymbolic
else ifeq ($(TARGET),cygwin)
############################################
####### Cygwin ########## TARGET
CXX := i686-pc-cygwin-g++
CC := i686-pc-cygwin-gcc
STRIP := i686-pc-cygwin-strip
LDFLAGS := -shared -Wl,--kill-at
CFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
CXXFLAGS := -D__int64="long long" -D_JNI_IMPLEMENTATION -D_REENTRANT -D_GNU_SOURCE
STATICLIB_EXT := lib
DYNAMICLIB_EXT := dll
LIBRARY_PREFIX := # empty
endif
endif