@ -13,19 +13,6 @@
DOCKER_IMAGE := tailscale-android-build-amd64-041425-1
export TS_USE_TOOLCHAIN = 1
# Auto-select an NDK from ANDROID_HOME (choose highest version available)
NDK_ROOT ?= $( shell ls -1d $( ANDROID_HOME) /ndk/* 2>/dev/null | sort -V | tail -n 1)
HOST_OS := $( shell uname | tr A-Z a-z)
i f e q ( $( HOST_OS ) , l i n u x )
STRIP_TOOL := $( NDK_ROOT) /toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy
e l s e i f e q ( $( HOST_OS ) , d a r w i n )
STRIP_TOOL := $( NDK_ROOT) /toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-objcopy
e n d i f
$(info Using NDK_ROOT : $( NDK_ROOT ) )
$(info Using STRIP_TOOL : $( STRIP_TOOL ) )
DEBUG_APK := tailscale-debug.apk
RELEASE_AAB := tailscale-release.aab
RELEASE_TV_AAB := tailscale-tv-release.aab
@ -64,6 +51,21 @@ ifeq ($(ANDROID_SDK_ROOT),)
e n d i f
export ANDROID_HOME ?= $( ANDROID_SDK_ROOT)
# Auto-select an NDK from ANDROID_HOME (choose highest version available)
NDK_ROOT ?= $( shell ls -1d $( ANDROID_HOME) /ndk/* 2>/dev/null | sort -V | tail -n 1)
HOST_OS := $( shell uname | tr A-Z a-z)
i f e q ( $( HOST_OS ) , l i n u x )
STRIP_TOOL := $( NDK_ROOT) /toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy
e l s e i f e q ( $( HOST_OS ) , d a r w i n )
STRIP_TOOL := $( NDK_ROOT) /toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-objcopy
e n d i f
$(info Using ANDROID_HOME : $( ANDROID_HOME ) )
$(info Using NDK_ROOT : $( NDK_ROOT ) )
$(info Using STRIP_TOOL : $( STRIP_TOOL ) )
# Attempt to find Android Studio for Linux configuration, which does not have a
# predetermined location.
ANDROID_STUDIO_ROOT ?= $( shell find ~/android-studio /usr/local/android-studio /opt/android-studio /Applications/Android\ Studio.app $( PROGRAMFILES) /Android/Android\ Studio -type d -maxdepth 1 2>/dev/null | head -n 1)
@ -312,7 +314,7 @@ checkandroidsdk: ## Check that Android SDK is installed
test : gradle -dependencies ## Run the Android tests
( cd android && ./gradlew test )
.PHONY : emulator
.PHONY : emulator
emulator : ## Start an android emulator instance
@echo "Checking installed SDK packages..."
@if ! $( ANDROID_HOME) /cmdline-tools/latest/bin/sdkmanager --list_installed | grep -q " $( AVD_IMAGE) " ; then \
@ -327,7 +329,7 @@ emulator: ## Start an android emulator instance
@echo "Starting emulator..."
@$( ANDROID_HOME) /emulator/emulator -avd " $( AVD) " -logcat-output /dev/stdout -netdelay none -netspeed full
.PHONY : install
.PHONY : install
install : $( DEBUG_APK ) ## Install the debug APK on a connected device
adb install -r $<
@ -335,7 +337,7 @@ install: $(DEBUG_APK) ## Install the debug APK on a connected device
run : install ## Run the debug APK on a connected device
adb shell am start -n com.tailscale.ipn/com.tailscale.ipn.MainActivity
.PHONY : docker -build -image
.PHONY : docker -build -image
docker-build-image : ## Builds the docker image for the android build environment if it does not exist
@echo " Checking if docker image $( DOCKER_IMAGE) already exists... "
@if ! docker images $( DOCKER_IMAGE) -q | grep -q . ; then \