diff options
-rw-r--r-- | Makefile | 37 | ||||
-rwxr-xr-x | platform/android/scripts/toolchain.sh | 2 | ||||
-rw-r--r-- | scripts/main.mk | 66 |
3 files changed, 22 insertions, 83 deletions
@@ -24,8 +24,6 @@ else .mason: ; endif -RUN = +$(MAKE) -f scripts/main.mk - default: @printf "You must specify a valid target\n" @@ -146,27 +144,34 @@ idocument: #### Android targets ##################################################### -# Builds a particular android architecture. -android-lib-%: - $(RUN) PLATFORM=android SUBPLATFORM=$* Makefile/all +ANDROID_ENV = platform/android/scripts/toolchain.sh +ANDROID_ABIS = arm-v5 arm-v7 arm-v8 x86 x86-64 mips -# Builds the default Android library -.PHONY: android-lib -android-lib: android-lib-arm-v7 +define ANDROID_RULES +build/android-$1/config.gypi: platform/android/scripts/configure.sh .mason configure + $$(shell $(ANDROID_ENV) $1) ./configure $$< $$@ android $1 -# Builds the selected/default Android library -.PHONY: android -android: android-lib - cd platform/android && ./gradlew --parallel --max-workers=$(JOBS) assemble$(BUILDTYPE) +build/android-$1/Makefile: build/android-$1/config.gypi + $$(shell $(ANDROID_ENV) $1) deps/run_gyp platform/android/platform.gyp -I$$< \ + -Dcoverage= -Goutput_dir=. --depth=. --generator-output=build/android-$1 -f make-android -# Builds all android architectures for distribution. -.PHONY: apackage -apackage: android-lib-arm-v5 android-lib-arm-v7 android-lib-arm-v8 android-lib-x86 android-lib-x86-64 android-lib-mips - cd platform/android && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) +android-lib-$1: build/android-$1/Makefile + $$(shell $(ANDROID_ENV) $1) $(MAKE) -j$(JOBS) -C build/android-$1 all + +apackage: android-lib-$1 +endef + +$(foreach abi,$(ANDROID_ABIS),$(eval $(call ANDROID_RULES,$(abi)))) + +android: android-lib-arm-v7 + cd platform/android && ./gradlew --parallel --max-workers=$(JOBS) assemble$(BUILDTYPE) test-android: cd platform/android && ./gradlew testReleaseUnitTest --continue +apackage: + cd platform/android && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) + #### Node targets ##################################################### NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp diff --git a/platform/android/scripts/toolchain.sh b/platform/android/scripts/toolchain.sh index 67cd0aa476..6eb6a229fe 100755 --- a/platform/android/scripts/toolchain.sh +++ b/platform/android/scripts/toolchain.sh @@ -4,7 +4,7 @@ set -e set -o pipefail export MASON_PLATFORM=android -export MASON_ANDROID_ABI=${MASON_ANDROID_ABI:-arm-v7} +export MASON_ANDROID_ABI=${1:-arm-v7} export PATH="`pwd`/.mason:${PATH}" export MASON_DIR="`pwd`/.mason" diff --git a/scripts/main.mk b/scripts/main.mk deleted file mode 100644 index 7f1f02011c..0000000000 --- a/scripts/main.mk +++ /dev/null @@ -1,66 +0,0 @@ -ifeq ($(shell uname -s), Darwin) - HOST_PLATFORM = osx -else - HOST_PLATFORM = linux -endif - -PLATFORM ?= $(HOST_PLATFORM) - -ifeq ($(PLATFORM),android) - CONFIGURE_PLATFORM = android - CONFIGURE_SUBPLATFORM = $(firstword $(SUBPLATFORM) arm-v7) - CONFIGURE_INPUT = platform/android/scripts/configure.sh - PLATFORM_OUTPUT = ./build/android-$(CONFIGURE_SUBPLATFORM) - - GYP_FLAVOR_SUFFIX = -android - ENV = $(shell MASON_ANDROID_ABI=$(CONFIGURE_SUBPLATFORM) ./platform/android/scripts/toolchain.sh) - -else - CONFIGURE_PLATFORM = $(PLATFORM) - CONFIGURE_SUBPLATFORM = $(shell uname -m) - CONFIGURE_INPUT = platform/$(CONFIGURE_PLATFORM)/scripts/configure.sh - PLATFORM_OUTPUT = ./build/$(PLATFORM)-$(CONFIGURE_SUBPLATFORM) -endif - -# Text formatting -TEXT_BOLD = \033[1m -COLOR_GREEN = \033[32m -COLOR_CYAN = \033[36m -COLOR_PINK = \033[35m -FORMAT_END = \033[0m - -# Never remove intermediate files -.SECONDARY: - -#### Dependencies ############################################################## - -ifneq (,$(wildcard .git/.)) -.mason: - git submodule update --init -else -.mason: ; -endif - -CONFIGURE_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi -.NOTPARALLEL: $(CONFIGURE_OUTPUT) -$(CONFIGURE_OUTPUT): $(CONFIGURE_INPUT) .mason configure - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running configure...$(FORMAT_END)\n" - $(ENV) ./configure $< $@ $(CONFIGURE_PLATFORM) $(CONFIGURE_SUBPLATFORM) - -#### Build files ############################################################### - -GYP_FLAGS += -I$(CONFIGURE_OUTPUT) -GYP_FLAGS += -Dcoverage=$(ENABLE_COVERAGE) -GYP_FLAGS += -Dcxx_host=$(CXX_HOST) -GYP_FLAGS += -Goutput_dir=. -GYP_FLAGS += --depth=. -GYP_FLAGS += --generator-output=$(PLATFORM_OUTPUT) - -.PHONY: Makefile/__project__ -Makefile/__project__: $(CONFIGURE_OUTPUT) - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" - $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f make$(GYP_FLAVOR_SUFFIX) - -Makefile/%: Makefile/__project__ - @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" - $(ENV) $(MAKE) -j$(JOBS) -C $(PLATFORM_OUTPUT) BUILDTYPE=$(BUILDTYPE) $* |