<commit_before>all: android osx ios

.PHONY: clean
.PHONY: clean-android
.PHONY: clean-osx
.PHONY: clean-xcode
.PHONY: clean-ios
.PHONY: clean-rpi
.PHONY: clean-linux
.PHONY: clean-benchmark
.PHONY: android
.PHONY: osx
.PHONY: xcode
.PHONY: ios
.PHONY: ios-sim
.PHONY: rpi
.PHONY: linux
.PHONY: benchmark
.PHONY: check-ndk
.PHONY: cmake-osx
.PHONY: cmake-xcode
.PHONY: cmake-android
.PHONY: cmake-ios
.PHONY: cmake-ios-sim
.PHONY: cmake-rpi
.PHONY: cmake-linux
.PHONY: install-android

ANDROID_BUILD_DIR = build/android
OSX_BUILD_DIR = build/osx
OSX_XCODE_BUILD_DIR = build/xcode
IOS_BUILD_DIR = build/ios
IOS_SIM_BUILD_DIR = build/ios-sim
RPI_BUILD_DIR = build/rpi
LINUX_BUILD_DIR = build/linux
TESTS_BUILD_DIR = build/tests
BENCH_BUILD_DIR = build/bench

TOOLCHAIN_DIR = toolchains
OSX_TARGET = tangram
IOS_TARGET = tangram
OSX_XCODE_PROJ = tangram.xcodeproj
IOS_XCODE_PROJ = tangram.xcodeproj

ifdef DEBUG
	BUILD_TYPE = -DCMAKE_BUILD_TYPE=Debug
endif
ifdef RELEASE
	BUILD_TYPE = -DCMAKE_BUILD_TYPE=Release
endif

ifdef ANDROID_X86
	ANDROID_BUILD_DIR = build/android-x86
	ANDROID_TOOLCHAIN = x86-clang3.6
	ANDROID_ARCH = x86
else
	ANDROID_TOOLCHAIN = arm-linux-androideabi-clang3.6
endif

ifndef ANDROID_ARCH
	ANDROID_ARCH = armeabi-v7a
endif

ifndef ANDROID_API_LEVEL
	ANDROID_API_LEVEL = android-15
endif

ifndef TANGRAM_CMAKE_OPTIONS
	TANGRAM_CMAKE_OPTIONS = \
		-DBENCHMARK=0 \
		-DUNIT_TESTS=0
endif

BENCH_CMAKE_PARAMS = \
	-DBENCHMARK=1 \
	-DAPPLICATION=0 \
	-DCMAKE_BUILD_TYPE=Release

UNIT_TESTS_CMAKE_PARAMS = \
	-DUNIT_TESTS=1 \<commit_msg>Add building for multiple arch for android<commit_after>all: android osx ios

.PHONY: clean
.PHONY: clean-android
.PHONY: clean-osx
.PHONY: clean-xcode
.PHONY: clean-ios
.PHONY: clean-rpi
.PHONY: clean-linux
.PHONY: clean-benchmark
.PHONY: android
.PHONY: osx
.PHONY: xcode
.PHONY: ios
.PHONY: ios-sim
.PHONY: rpi
.PHONY: linux
.PHONY: benchmark
.PHONY: check-ndk
.PHONY: cmake-osx
.PHONY: cmake-xcode
.PHONY: cmake-android
.PHONY: cmake-ios
.PHONY: cmake-ios-sim
.PHONY: cmake-rpi
.PHONY: cmake-linux
.PHONY: install-android

ANDROID_BUILD_DIR = build/android
OSX_BUILD_DIR = build/osx
OSX_XCODE_BUILD_DIR = build/xcode
IOS_BUILD_DIR = build/ios
IOS_SIM_BUILD_DIR = build/ios-sim
RPI_BUILD_DIR = build/rpi
LINUX_BUILD_DIR = build/linux
TESTS_BUILD_DIR = build/tests
BENCH_BUILD_DIR = build/bench

TOOLCHAIN_DIR = toolchains
OSX_TARGET = tangram
IOS_TARGET = tangram
OSX_XCODE_PROJ = tangram.xcodeproj
IOS_XCODE_PROJ = tangram.xcodeproj

ifdef DEBUG
	BUILD_TYPE = -DCMAKE_BUILD_TYPE=Debug
endif
ifdef RELEASE
	BUILD_TYPE = -DCMAKE_BUILD_TYPE=Release
endif

ifdef ANDROID_ARCH
	ANDROID_BUILD_DIR = build/android-${ANDROID_ARCH}
	ifeq ($(ANDROID_ARCH), x86)
		ANDROID_TOOLCHAIN = x86-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), x86_64)
		ANDROID_TOOLCHAIN = x86_64-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), armeabi) #TODO: Does not work - linking error
		ANDROID_TOOLCHAIN = arm-linux-androideabi-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), armeabi-v7a)
		ANDROID_TOOLCHAIN = arm-linux-androideabi-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), arm64-v8a)
		ANDROID_TOOLCHAIN = aarch64-linux-android-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), mips) #TODO: Does not work - linking error
		ANDROID_TOOLCHAIN = mipsel-linux-android-clang3.6
	endif
	ifeq ($(ANDROID_ARCH), mips64)
		ANDROID_TOOLCHAIN = mips64el-linux-android-clang3.6
	endif
else
	ANDROID_ARCH = armeabi-v7a
	ANDROID_TOOLCHAIN = arm-linux-androideabi-clang3.6
endif

#$(info ANDROID_ARCH is ${ANDROID_ARCH}) 
#$(info ANDROID_TOOLCHAIN is ${ANDROID_TOOLCHAIN}) 
#$(info ANDROID_BUILD_DIR is ${ANDROID_BUILD_DIR}) 

ifndef ANDROID_API_LEVEL
	ANDROID_API_LEVEL = android-15
endif

ifndef TANGRAM_CMAKE_OPTIONS
	TANGRAM_CMAKE_OPTIONS = \
		-DBENCHMARK=0 \
		-DUNIT_TESTS=0
endif

BENCH_CMAKE_PARAMS = \
	-DBENCHMARK=1 \
	-DAPPLICATION=0 \
	-DCMAKE_BUILD_TYPE=Release

UNIT_TESTS_CMAKE_PARAMS = \
	-DUNIT_TESTS=1 \
{'fraction_non_alphanumeric': 0.09864207020240841, 'fraction_numerical': 0.016910069177555727, 'mean_word_length': 4.951219512195122, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6728086', 'n_tokens_mistral': 1830, 'n_tokens_neox': 1755, 'n_words': 317}