From c4ba219581bfaa5c9ef5ffa1280a7879d8122f2d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 23 May 2016 17:50:02 -0700 Subject: [build] Simplify control flow in main.mk --- scripts/main.mk | 73 +++++++++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 44 deletions(-) (limited to 'scripts') diff --git a/scripts/main.mk b/scripts/main.mk index 70a84fac15..cf062afc73 100644 --- a/scripts/main.mk +++ b/scripts/main.mk @@ -1,57 +1,41 @@ ifeq ($(shell uname -s), Darwin) - PLATFORM ?= osx -else ifeq ($(shell uname -s), Linux) - PLATFORM ?= linux -endif - -ifeq ($(PLATFORM),android) - SUBPLATFORM ?= arm-v7 - GYP_FLAVOR_SUFFIX = -android - ENV = $(shell MASON_ANDROID_ABI=$(SUBPLATFORM) ./platform/android/scripts/toolchain.sh) -else ifeq ($(PLATFORM),ios) - SUBPLATFORM = all -else ifeq ($(PLATFORM),osx) - SUBPLATFORM = x86_64 + HOST_PLATFORM = osx else - SUBPLATFORM ?= $(shell uname -m) + HOST_PLATFORM = linux endif -ifeq ($(PLATFORM),node) - ifeq ($(shell uname -s), Darwin) - CONFIGURE_PLATFORM ?= osx - CONFIGURE_SUBPLATFORM = $(SUBPLATFORM) - PLATFORM_SLUG = node-osx-$(SUBPLATFORM) - else ifeq ($(shell uname -s), Linux) - CONFIGURE_PLATFORM ?= linux - CONFIGURE_SUBPLATFORM = $(SUBPLATFORM) - PLATFORM_SLUG = node-linux-$(SUBPLATFORM) - endif -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) -ifeq ($(PLATFORM),qt) - ifeq ($(shell uname -s), Darwin) - CONFIGURE_PLATFORM ?= osx - CONFIGURE_SUBPLATFORM = $(SUBPLATFORM) - PLATFORM_SLUG = qt-osx-$(SUBPLATFORM) - else ifeq ($(shell uname -s), Linux) - CONFIGURE_PLATFORM ?= linux - CONFIGURE_SUBPLATFORM = $(SUBPLATFORM) - PLATFORM_SLUG = qt-linux-$(SUBPLATFORM) - endif + GYP_FLAVOR_SUFFIX = -android + ENV = $(shell MASON_ANDROID_ABI=$(CONFIGURE_SUBPLATFORM) ./platform/android/scripts/toolchain.sh) +else ifeq ($(PLATFORM),qt) + CONFIGURE_PLATFORM = $(HOST_PLATFORM) + CONFIGURE_SUBPLATFORM = $(shell uname -m) CONFIGURE_INPUT = platform/qt/scripts/configure.sh + PLATFORM_OUTPUT = ./build/qt-$(HOST_PLATFORM)-$(CONFIGURE_SUBPLATFORM) # Cross compilation support - ENV = $(shell MASON_PLATFORM_VERSION=$(SUBPLATFORM) ./platform/qt/scripts/toolchain.sh) -endif + ENV = $(shell MASON_PLATFORM_VERSION=$(CONFIGURE_SUBPLATFORM) ./platform/qt/scripts/toolchain.sh) -# Defaults if not set -PLATFORM_SLUG ?= $(PLATFORM)-$(SUBPLATFORM) -PLATFORM_OUTPUT ?= ./build/$(PLATFORM_SLUG) -CONFIGURE_PLATFORM ?= $(PLATFORM) -CONFIGURE_SUBPLATFORM ?= $(SUBPLATFORM) -CONFIGURE_INPUT ?= platform/$(CONFIGURE_PLATFORM)/scripts/configure.sh -CONFIGURE_OUTPUT ?= $(PLATFORM_OUTPUT)/config.gypi +else ifeq ($(PLATFORM),node) + CONFIGURE_PLATFORM = $(HOST_PLATFORM) + CONFIGURE_SUBPLATFORM = $(shell uname -m) + CONFIGURE_INPUT = platform/$(HOST_PLATFORM)/scripts/configure.sh + PLATFORM_OUTPUT = ./build/node-$(HOST_PLATFORM)-$(CONFIGURE_SUBPLATFORM) + +else + CONFIGURE_PLATFORM = $(PLATFORM) + CONFIGURE_SUBPLATFORM = $(shell uname -m) + CONFIGURE_INPUT = platform/$(CONFIGURE_PLATFORM)/scripts/configure.sh + PLATFORM_OUTPUT = ./build/$(PLATFORM)-$(CONFIGURE_SUBPLATFORM) +endif ifneq (,$(findstring clang,$(CXX))) CXX_HOST = "clang" @@ -78,6 +62,7 @@ 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" -- cgit v1.2.1