Files
commandergenius/project/jni/python3/Makefile
2016-12-03 11:31:30 +01:00

99 lines
2.1 KiB
Makefile

## Setup.
all: build
# Get configuration.
mk/env.mk: env
@bash --noprofile --norc -c 'source ./env; set -o posix; set' | egrep '^(ANDROID|SDK|NDK|BUILD|TEST|PYTHON)_' > $@
-include mk/env.mk
# A formula.
define formula
$1: $1-$2
#$1-$2: ndk $3
$1-$2: $3
$$(info Checking $1 $2 sources...)
@wget -N -P "src/" -i "mk/$1/$2/sources.txt"
ifeq ("$$(wildcard build/.built-$(BUILD_IDENTIFIER)/$1-$2)","")
$$(info Building $1 $2...)
@bash --noprofile --norc mk/build_single.sh $1 $2
@mkdir -p build/.built-$(BUILD_IDENTIFIER)
@touch build/.built-$(BUILD_IDENTIFIER)/$1-$2
endif
endef
## Building.
build: python_modules python
# Main Python.
$(eval $(call formula,python,3.4.3))
# Optional Python modules.
python_modules: $(foreach mod,$(subst ',,$(PYTHON_OPTIONAL_MODULES)),python_$(mod))
# Python lzma support.
$(eval $(call formula,xz,5.2.1))
python_lzma: xz
# Python bzip2 support.
$(eval $(call formula,bzip2,1.0.6))
python_bz2: bzip2
# Python readline support.
$(eval $(call formula,readline,6.3))
python_readline: readline
# Python SSL support.
$(eval $(call formula,openssl,1.0.2d))
python_ssl: openssl
# Python curses support.
$(eval $(call formula,ncurses,5.9))
python_curses: ncurses
# Python SQLite support.
$(eval $(call formula,sqlite,3.8.10.2))
python_sqlite3: sqlite
# Python (g)dbm support.
$(eval $(call formula,gdbm,1.11))
python_gdbm: gdbm
# Android NDK.
#ndk:
# $(info Checking NDK sources...)
# @wget -N -P "sdk/" $(shell bash mk/ndk_source.sh)
#ifeq ("$(wildcard build/.built-ndk-$(BUILD_IDENTIFIER))","")
# $(info Preparing NDK toolchain...)
# @bash --noprofile --norc mk/build_ndk.sh
# @touch build/.built-ndk-$(BUILD_IDENTIFIER)
#endif
## Cleaning.
clean: clean_generated clean_builds
@rm -rf "$(ANDROID_TEST_PREFIX)"
@rm -rf "$(ANDROID_TOOL_PREFIX)"
clean_generated:
@find ./src -mindepth 1 -maxdepth 1 -type d -exec rm -rf "{}" \;
clean_builds:
@rm -rf "$(ANDROID_PREFIX)"
## Testing.
test: test_setup
@bash --noprofile --norc mk/test.sh
test_setup:
ifeq ("$(wildcard build-vm/$(TEST_IDENTIFIER))","")
@bash --noprofile --norc mk/test_setup.sh
endif