Skip to content

Instantly share code, notes, and snippets.

@mariuz mariuz/make.android.x86_64
Last active Oct 24, 2016

Embed
What would you like to do?
firebird make file for android x86_64
ifeq ($(NDK),)
$(error Must export NDK location before building for Android)
endif
NDK_ROOT:=$(NDK)
#NDK_LOG:=1
include $(NDK)/build/core/init.mk
TOOLCHAIN_DIR:=$(foreach chain, $(NDK_ALL_TOOLCHAINS), $(if $(findstring x86_64, $(chain)), $(chain), ))
# Filter out clang
TEMP_LIST_DIR := $(foreach chain, $(TOOLCHAIN_DIR), $(if $(findstring clang, $(chain)), , $(chain)))
ifdef TEMP_LIST_DIR
TOOLCHAIN_DIR := $(TEMP_LIST_DIR)
endif
# use freshmost compiler
TOOLCHAIN_DIR:=$(lastword $(TOOLCHAIN_DIR))
ifeq ($(HOST_TAG64),)
HOST_TAG64:=linux-x86
endif
NDK_TOOLCHAIN_VERSION:=$(shell echo $(TOOLCHAIN_DIR) | awk -F - '{print $$NF;}')
CROSS_PLATFORM:=$(NDK)/platforms/android-24/arch-x86_64
CROSS_PREFIX:=$(NDK)/toolchains/$(TOOLCHAIN_DIR)/prebuilt/$(HOST_TAG64)/bin/x86_64-linux-android-
CXX:=$(CROSS_PREFIX)g++
CC:=$(CROSS_PREFIX)gcc
AR:=$(CROSS_PREFIX)ar
AS:=$(CROSS_PREFIX)as
LD:=$(CROSS_PREFIX)ld
NM:=$(CROSS_PREFIX)nm
OBJCOPY:=$(CROSS_PREFIX)objcopy
OBJDUMP:=$(CROSS_PREFIX)objdump
RANLIB:=$(CROSS_PREFIX)ranlib
STRIP:=$(CROSS_PREFIX)strip
COMMON_FLAGS=-ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DANDROID -DAMD64 -pipe -MMD -fPIC -fmessage-length=0 \
-I$(ROOT)/extern/libtommath --sysroot=$(CROSS_PLATFORM) \
-I$(CROSS_PLATFORM)/usr/include -I$(ROOT)/gen/cross
OPTIMIZE_FLAGS=-fno-omit-frame-pointer
WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable
PROD_FLAGS=$(COMMON_FLAGS) $(OPTIMIZE_FLAGS)
DEV_FLAGS=$(COMMON_FLAGS) $(WARN_FLAGS)
CROSS_CONFIG=android.x86_64
LDFLAGS += --sysroot=$(CROSS_PLATFORM) -L$(NDK)/sources/cxx-stl/gnu-libstdc++/$(NDK_TOOLCHAIN_VERSION)/libs/x86_64 \
-L$(NDK)/sources/cxx-stl/gnu-libstdc++/libs/x86_64
DroidLibs := -lm -ldl -lsupc++
LINK_LIBS = $(DroidLibs)
STATICLINK_LIBS = $(DroidLibs)
SO_LINK_LIBS = $(DroidLibs)
EXE_LINK_OPTIONS= $(LDFLAGS) $(UNDEF_FLAGS) $(LIB_PATH_OPTS) $(LINK_EMPTY_SYMBOLS)
LIB_LINK_OPTIONS= $(LDFLAGS) -shared
UNICODE_DIR := $(shell dirname `find /usr/include -name ucnv.h`)
UNICODE_DIR := $(filter %unicode, $(UNICODE_DIR))
UNICODE_DIR := $(firstword $(UNICODE_DIR))
ifndef UNICODE_DIR
$(error ERROR while locating ICU include directory, probably missing ucnv.h)
endif
.PHONY: prerequisites
prerequisites: $(ROOT)/gen/cross/unicode
$(ROOT)/gen/cross/unicode:
echo $(UNICODE_DIR)
rm -rf $(ROOT)/gen/cross
mkdir $(ROOT)/gen/cross
ln -s $(UNICODE_DIR) cross/unicode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.