summaryrefslogtreecommitdiff
path: root/scripts/main.mk
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-04-22 16:26:13 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-04-25 16:44:28 +0300
commit8b9f84d815c3291915789d63ddf570cfed4f2fa2 (patch)
treef2ba52a7a9e0608cf8a53e8fd52704097135fc38 /scripts/main.mk
parent4c548fe0bb62b5bdd045013ad08288a0615a3489 (diff)
downloadqtlocation-mapboxgl-8b9f84d815c3291915789d63ddf570cfed4f2fa2.tar.gz
[Qt] Add toolchain support
Enables cross-compilation.
Diffstat (limited to 'scripts/main.mk')
-rw-r--r--scripts/main.mk55
1 files changed, 31 insertions, 24 deletions
diff --git a/scripts/main.mk b/scripts/main.mk
index d5d0d74ff1..466ffff219 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -16,38 +16,45 @@ else
export SUBPLATFORM ?= $(shell uname -m)
endif
-ifneq ($(PLATFORM),node)
- export MASON_PLATFORM = $(PLATFORM)
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = $(PLATFORM)-$(SUBPLATFORM)
-else ifeq ($(shell uname -s), Darwin)
- export MASON_PLATFORM = osx
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = node-osx-$(SUBPLATFORM)
-else ifeq ($(shell uname -s), Linux)
- export MASON_PLATFORM = linux
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = node-linux-$(SUBPLATFORM)
+ifeq ($(PLATFORM),node)
+ ifeq ($(shell uname -s), Darwin)
+ export MASON_PLATFORM ?= osx
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-osx-$(SUBPLATFORM)
+ else ifeq ($(shell uname -s), Linux)
+ export MASON_PLATFORM ?= linux
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-linux-$(SUBPLATFORM)
+ endif
endif
-export PLATFORM_OUTPUT = ./build/$(PLATFORM_SLUG)
-export PLATFORM_CONFIG_INPUT = platform/$(MASON_PLATFORM)/scripts/configure.sh
-export PLATFORM_CONFIG_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi
-
ifeq ($(PLATFORM),qt)
ifeq ($(shell uname -s), Darwin)
- export MASON_PLATFORM = osx
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = qt-osx-$(SUBPLATFORM)
- export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+ export MASON_PLATFORM ?= osx
+
+ ifneq ($(MASON_PLATFORM), osx)
+ export GYP_FLAVOR_SUFFIX = -$(MASON_PLATFORM)
+ endif
else ifeq ($(shell uname -s), Linux)
- export MASON_PLATFORM = linux
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = qt-linux-$(SUBPLATFORM)
- export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+ export MASON_PLATFORM ?= linux
endif
+
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = qt-$(MASON_PLATFORM)-$(SUBPLATFORM)
+ export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+
+ # Cross compilation support
+ ENV = $(shell MASON_PLATFORM_VERSION=$(SUBPLATFORM) ./platform/qt/scripts/toolchain.sh)
endif
+# Defaults if not set
+export PLATFORM_OUTPUT ?= ./build/$(PLATFORM_SLUG)
+export PLATFORM_CONFIG_INPUT ?= platform/$(MASON_PLATFORM)/scripts/configure.sh
+export PLATFORM_CONFIG_OUTPUT ?= $(PLATFORM_OUTPUT)/config.gypi
+export MASON_PLATFORM ?= $(PLATFORM)
+export MASON_PLATFORM_VERSION ?= $(SUBPLATFORM)
+export PLATFORM_SLUG ?= $(PLATFORM)-$(SUBPLATFORM)
+
ifneq (,$(findstring clang,$(CXX)))
CXX_HOST = "clang"
else ifneq (,$(findstring g++,$(CXX)))