Skip to content

Commit

Permalink
add support for Android NDK r16b
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredh committed Feb 7, 2018
1 parent 08352cc commit ecf56e9
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
#

# Paths to your Android SDK/NDK
NDK_PATH := $(HOME)/android/android-ndk-r14
NDK_PATH := $(HOME)/android/android-ndk-r16b
SDK_PATH := $(HOME)/android/android-sdk

PLATFORM := android-17
#
# Android API-levels:
#
# API-Level: Version:
# --------- -------
# 17 4.2.x
# 18 4.3.x
# 19 4.4 - 4.4.4
# 21 5.0
#
API_LEVEL := 21

PLATFORM := android-$(API_LEVEL)

#
# Target architecture
#
TRIPLE := arm-linux-androideabi


# Path to install binaries on your Android-device
TARGET_PATH=/data/local/tmp
Expand All @@ -28,7 +46,7 @@ endif


# Tools
SYSROOT := $(NDK_PATH)/platforms/$(PLATFORM)/arch-arm
SYSROOT := $(NDK_PATH)/sysroot
PREBUILT := $(NDK_PATH)/toolchains/arm-linux-androideabi-4.9/prebuilt
BIN := $(PREBUILT)/$(HOST_OS)/bin
CC := $(BIN)/arm-linux-androideabi-gcc
Expand All @@ -42,7 +60,9 @@ PWD := $(shell pwd)
#
# NOTE: use -isystem to avoid warnings in system header files
CFLAGS := \
-D__ANDROID_API__=$(API_LEVEL) \
-isystem $(SYSROOT)/usr/include/ \
-isystem $(SYSROOT)/usr/include/$(TRIPLE) \
-I$(PWD)/openssl/include \
-I$(PWD)/opus/include_opus \
-I$(PWD)/speex/include \
Expand All @@ -52,6 +72,7 @@ CFLAGS := \
-march=armv7-a \
-fPIE \
-DCONFIG_PATH='\"$(CONFIG_PATH)\"'

LFLAGS := -L$(SYSROOT)/usr/lib/ \
-L$(PWD)/openssl \
-L$(PWD)/opus/.libs \
Expand All @@ -78,6 +99,7 @@ COMMON_FLAGS := CC=$(CC) \
HAVE_LIBPTHREAD= \
HAVE_INET_PTON=1 \
HAVE_INET6=1 \
HAVE_GETIFADDRS= \
PEDANTIC= \
OS=linux ARCH=arm \
USE_OPENSSL=yes \
Expand Down Expand Up @@ -150,11 +172,17 @@ clean:
make distclean -C rem
make distclean -C re


OPENSSL_FLAGS := \
no-shared \
-D__ANDROID_API__=$(API_LEVEL) \
-I$(SYSROOT)/usr/include/$(TRIPLE)

.PHONY: openssl
openssl:
cd openssl && \
CC=$(CC) RANLIB=$(RANLIB) AR=$(AR) \
./Configure android no-shared && \
./Configure android $(OPENSSL_FLAGS) && \
ANDROID_DEV=$(SYSROOT)/usr \
CROSS_SYSROOT="$(SYSROOT)" \
make build_libs
Expand Down

0 comments on commit ecf56e9

Please sign in to comment.