Makefile.local picks up ANDROID_SDK_ROOT environment variable, if set.

If not set, it falls back to the original paths:

* `$(USERHOME)/AppData/Local/Android/Sdk` on Windows
* `$(HOME)/Library/Android/sdk` on MacOS
* `/opt/AndroidSDK` on Linux

This allows users to dictate which SDK root they'd like to use without making
local modifications.
This commit is contained in:
Pete Lewis 2022-03-18 11:33:17 -07:00
parent 471f8a549c
commit d08688b987

View file

@ -4,18 +4,21 @@ ANDROID_NDK_VERSION=21.1.6352462
UNAME := $(shell uname) UNAME := $(shell uname)
ifeq ($(UNAME), Linux) ifeq ($(UNAME), Linux)
ANDROID_NDK=/opt/AndroidSDK/ndk/$(ANDROID_NDK_VERSION) ANDROID_SDK_ROOT?=/opt/AndroidSDK
ANDROID_NDK=$(ANDROID_SDK_ROOT)/ndk/$(ANDROID_NDK_VERSION)
ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-$(ANDROID_SDK_VERSION)-clang ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-$(ANDROID_SDK_VERSION)-clang
ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION) ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION)
ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ranlib
else else
ifeq ($(UNAME), Darwin) ifeq ($(UNAME), Darwin)
ANDROID_NDK=~/Library/Android/sdk/ndk/$(ANDROID_NDK_VERSION) ANDROID_SDK_ROOT?=$(HOME)/Library/Android/sdk
ANDROID_NDK=$(ANDROID_SDK_ROOT)/ndk/$(ANDROID_NDK_VERSION)
ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-$(ANDROID_SDK_VERSION)-clang ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-$(ANDROID_SDK_VERSION)-clang
ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION) ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION)
ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ranlib ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ranlib
else else
ANDROID_NDK=C:/Users/simon/AppData/Local/Android/Sdk/ndk/$(ANDROID_NDK_VERSION) ANDROID_SDK_ROOT?=$(USERPROFILE)/AppData/Local/Android/Sdk
ANDROID_NDK=$(ANDROID_SDK_ROOT)/ndk/$(ANDROID_NDK_VERSION)
ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe ANDROID_CC=$(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION) ANDROID_CFLAGS=--target=aarch64-linux-$(ANDROID_SDK_VERSION)
ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib.exe ANDROID_RANLIB=$(ANDROID_NDK)/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android-ranlib.exe