48 lines
1.5 KiB
Makefile
48 lines
1.5 KiB
Makefile
|
include ../common.mk
|
||
|
|
||
|
## NDK configuration.
|
||
|
NDK = $(ANDROID_NDK)
|
||
|
NDK_TARGETARCH = aarch64-linux-android
|
||
|
NDK_TARGETSHORTARCH = arm64
|
||
|
NDK_TOOLVER = 4.9
|
||
|
NDK_HOSTARCH = linux-x86_64
|
||
|
NDK_TOOLS = $(NDK)/toolchains/llvm/prebuilt/$(NDK_HOSTARCH)/bin
|
||
|
NDK_SYSROOT = $(NDK)/sysroot
|
||
|
NDK_TOOL = $(NDK_TOOLS)/clang
|
||
|
NDK_LIBS = $(NDK)/toolchains/$(NDK_TARGETARCH)-$(NDK_TOOLVER)/prebuilt/linux-x86_64/lib/gcc/$(NDK_TARGETARCH)/4.9.x
|
||
|
NDK_INCLUDES = -I$(NDK)/sysroot/usr/include -I$(NDK)/sysroot/usr/include/$(NDK_TARGETARCH)
|
||
|
NDK_SYSROOT = $(NDK)/platforms/android-$(NDK_TARGETVER)/arch-$(NDK_TARGETSHORTARCH)
|
||
|
|
||
|
OPT = -std=c99 -Os \
|
||
|
-fdata-sections \
|
||
|
-ffunction-sections \
|
||
|
-fPIE \
|
||
|
-Wall \
|
||
|
-target $(NDK_TARGETARCH)
|
||
|
|
||
|
CFLAGS = $(OPT) \
|
||
|
$(NDK_INCLUDES) \
|
||
|
-D__ANDROID_API__=$(NDK_TARGETVER) \
|
||
|
-D_SOCKLEN_T_DECLARED
|
||
|
|
||
|
LDFLAGS = $(OPT) \
|
||
|
-pie \
|
||
|
-Wl,--gc-sections \
|
||
|
--sysroot=$(NDK_SYSROOT) \
|
||
|
-B $(ANDROID_NDK)/toolchains/$(NDK_TARGETARCH)-$(NDK_TOOLVER)/prebuilt/linux-x86_64/$(NDK_TARGETARCH)/bin \
|
||
|
-L$(NDK_LIBS)
|
||
|
|
||
|
all:
|
||
|
CC=$(NDK_TOOL) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" make -C src
|
||
|
|
||
|
clean:
|
||
|
make -C src clean
|
||
|
|
||
|
push:
|
||
|
adb root
|
||
|
adb remount
|
||
|
adb shell "rm -rf /data/app/mbedtls/*"
|
||
|
adb shell "mkdir -p /data/app/mbedtls"
|
||
|
adb push src/programs/ssl/ssl_client1 /data/app/mbedtls/
|
||
|
adb push src/programs/ssl/ssl_server /data/app/mbedtls/
|
||
|
adb push src/programs/test/benchmark /data/app/mbedtls/
|