diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-23 17:50:02 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-05-23 18:26:54 -0700 |
commit | c4ba219581bfaa5c9ef5ffa1280a7879d8122f2d (patch) | |
tree | 65b06b56da3e57a0b6dbe11d1375ab96179f2d50 /scripts | |
parent | a8014dbe3fe0b28c2b63de41a96534cdc7ae2924 (diff) | |
download | qtlocation-mapboxgl-c4ba219581bfaa5c9ef5ffa1280a7879d8122f2d.tar.gz |
[build] Simplify control flow in main.mk
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/main.mk | 73 |
1 files changed, 29 insertions, 44 deletions
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" |