diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-08-03 17:04:31 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-08-04 14:08:58 +0200 |
commit | e6053aa5475e03568f39e4967dc49ef4aba3c5fe (patch) | |
tree | 0b8fa3e3f5159f28210ff2c0611d8900d9577006 /Makefile | |
parent | b44fe1c7af889089a640097583add8cd90e9330a (diff) | |
download | qtlocation-mapboxgl-e6053aa5475e03568f39e4967dc49ef4aba3c5fe.tar.gz |
Make build system architecture agnostic to remove Android special case
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 254 |
1 files changed, 65 insertions, 189 deletions
@@ -1,225 +1,101 @@ -BUILDTYPE ?= Release -PYTHON ?= python -PREFIX ?= /usr/local -ANDROID_ABI ?= arm-v7 +export BUILDTYPE ?= Release +export BUILD_TEST ?= 1 +export BUILD_RENDER ?= 1 +# Determine build platform ifeq ($(shell uname -s), Darwin) -HOST = osx -HEADLESS = cgl -JOBS ?= $(shell sysctl -n hw.ncpu) -endif - -ifeq ($(shell uname -s), Linux) -HOST = linux -JOBS ?= $(shell grep --count processor /proc/cpuinfo) -BUILD_ROOT = $(shell pwd) -endif - -JOBS ?= 1 - -all: mbgl - -include config/defaults.mk - -#### Dependencies ############################################################## - -# Wildcard targets get removed after build by default, but we want to preserve the config. -.PRECIOUS: config/%.gypi -config/%.gypi: CMD = ./configure config/$*.gypi -config/%.gypi: configure - @$(ENV_$*) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi - -styles/styles: - git submodule update --init styles - -ifeq ($(shell uname -s), Darwin) -SMCalloutView: - git submodule update --init platform/ios/vendor/SMCalloutView +export BUILD = osx +export JOBS ?= $(shell sysctl -n hw.ncpu) +export XCPRETTY := $(shell ./scripts/xcpretty.sh) +else ifeq ($(shell uname -s), Linux) +export BUILD = linux +export JOBS ?= $(shell grep --count processor /proc/cpuinfo) else -SMCalloutView: +$(error Cannot determine build platform) endif +export BUILD_VERSION = $(shell uname -m) -geojsonvt: - git submodule update --init src/mbgl/util/geojsonvt - -KIF: - git submodule update --init test/ios/KIF - - -#### Build files ############################################################### - -.PRECIOUS: Makefile/project -Makefile/project: config/$(HOST).gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/$(HOST).gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make - -.PRECIOUS: Xcode/project -Xcode/project: config/$(HOST).gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/$(HOST).gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f xcode - - -#### Library builds ############################################################ - -mbgl: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) everything - -standalone: Makefile/project - LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) standalone - -install: Makefile/project - LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) install - - -##### Test builds ############################################################## - -.PHONY: test -test: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) test - -test-%: test - ./scripts/run_tests.sh "build/$(HOST)/$(BUILDTYPE)/test" --gtest_filter=$* - -.PHONY: xtest -xtest: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xtest: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target test -jobs $(JOBS) $(XCPRETTY) - -xtest-%: xtest - ./scripts/run_tests.sh "build/osx/Build/Products/$(BUILDTYPE)/test" --gtest_filter=$* - +RUN = @$(MAKE) -f scripts/main.mk -#### Mac OS X application builds ############################################### +default: ; @printf "You must specify a valid target\n" -.PHONY: osx run-osx -osx: Makefile/project - $(MAKE) -C build/osx BUILDTYPE=$(BUILDTYPE) osxapp +#### OS X targets ############################################################## -run-osx: osx - "build/osx/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +ifeq ($(BUILD),osx) +.PHONY: osx xosx run-osx run-xosx +osx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Makefile/osxapp +xosx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/osxapp +run-osx: osx ; @"build/osx-x86_64/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +run-xosx: xosx ; @"gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" -run-valgrind-osx: osx - (valgrind --leak-check=full --suppressions=scripts/valgrind.sup build/osx/$(BUILDTYPE)/Mapbox\ GL.app/Contents/MacOS/Mapbox\ GL) +.PHONY: Xcode/osx Xcode/ios +Xcode/ios: ; $(RUN) HOST=ios Xcode/__project__ +Xcode/osx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/__project__ -.PHONY: xosx-proj xosx run-xosx -xosx-proj: Xcode/project - open ./build/osx/gyp/osx.xcodeproj +.PHONY: xproj iproj +xproj: Xcode/osx ; @open ./build/osx-x86_64/gyp/osx.xcodeproj +iproj: Xcode/ios ; @open ./build/ios-all/gyp/ios.xcodeproj -xosx: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xosx: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target osxapp -jobs $(JOBS) $(XCPRETTY) +.PHONY: ios ibench isim +ios ibench isim: export XCODEBUILD_ARGS += PROVISIONING_PROFILE="$$(PROVISIONING_PROFILE)" -run-xosx: xosx - "gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +ios: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64 armv7 armv7s" +ios: ; $(RUN) HOST=ios Xcode/iosapp -# Legacy name -xproj: xosx-proj +isim: export XCODEBUILD_ARGS += -sdk iphonesimulator ARCHS="x86_64 i386" +isim: ; $(RUN) HOST=ios Xcode/iosapp +ibench: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64" +ibench: ; $(RUN) HOST=ios Xcode/ios-bench +.PHONY: ipackage ipackage-strip ipackage-sim itest +ipackage: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh +ipackage-strip: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh strip +ipackage-sim: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh sim +itest: ipackage-sim ; ./scripts/ios/test.sh +endif -#### iOS application builds #################################################### - -.PRECIOUS: Xcode/ios -Xcode/ios: gyp/ios.gyp config/ios.gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/ios.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode - -.PHONY: ios-proj ios isim ipackage -ios-proj: Xcode/ios - open ./build/ios/gyp/ios.xcodeproj - -ios: XCPRETTY := $(shell ./scripts/xcpretty.sh) -ios: Xcode/ios - xcodebuild -sdk iphoneos ARCHS="arm64 armv7 armv7s" PROVISIONING_PROFILE="19324a54-7455-4f0b-8e1c-e6957c718ebc" -project ./build/ios/gyp/ios.xcodeproj -configuration Release -target iosapp -jobs $(JOBS) $(XCPRETTY) - -ibench: XCPRETTY := $(shell ./scripts/xcpretty.sh) -ibench: Xcode/ios - xcodebuild -sdk iphoneos ARCHS="arm64" PROVISIONING_PROFILE="19324a54-7455-4f0b-8e1c-e6957c718ebc" -project ./build/ios/gyp/ios.xcodeproj -configuration Release -target ios-bench -jobs $(JOBS) $(XCPRETTY) - -isim: XCPRETTY := $(shell ./scripts/xcpretty.sh) -isim: Xcode/ios - xcodebuild -sdk iphonesimulator ARCHS="x86_64 i386" -project ./build/ios/gyp/ios.xcodeproj -configuration Debug -target iosapp -jobs $(JOBS) $(XCPRETTY) - -ipackage: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh - -ipackage-strip: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh strip - -ipackage-sim: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh sim - -itest: ipackage-sim KIF - ./scripts/ios/test.sh - -# Legacy name -iproj: ios-proj - - -#### Linux application builds ################################################## - -.PHONY: linux run-linux -linux: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) linuxapp - -run-linux: linux - (cd build/$(HOST)/$(BUILDTYPE) && ./mapbox-gl) - -run-valgrind-linux: linux - (cd build/$(HOST)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=$(BUILD_ROOT)/scripts/valgrind.sup ./mapbox-gl) - -.PHONY: xlinux run-xlinux -xlinux: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xlinux: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target linuxapp -jobs $(JOBS) $(XCPRETTY) - -run-xlinux: xlinux - "gyp/build/$(BUILDTYPE)/mapbox-gl" - - -#### Android libaries ######################################################### +#### All platforms targets ##################################################### -.PRECIOUS: Makefile/android-% -Makefile/android-%: CMD = deps/run_gyp android/mapboxgl-app.gyp $(CONFIG_android-$*) $(LIBS_android) --generator-output=./build/android-$* -f make-android -Makefile/android-%: config/android-%.gypi styles/styles geojsonvt - @echo $(CMD) - @$(ENV_android-$*) $(CMD) +.PHONY: linux xlinux run-linux run-xlinux +linux: ; $(RUN) Makefile/linuxapp +.PHONY: android android-lib # Builds a particular android architecture. -android-lib-%: Makefile/android-% - @$(ENV_android-$*) ./scripts/flock.py -v build/Android.lock $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp +android-lib-%: ; $(RUN) HOST=android HOST_VERSION=$* Makefile/androidapp -# Builds the selected/default Android library -android-lib: android-lib-$(ANDROID_ABI) +# Builds the default Android library +android-lib: ; $(RUN) HOST=android Makefile/androidapp # Builds the selected/default Android library -android: android-lib-$(ANDROID_ABI) +android: android-lib cd android/java && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) # Builds all android architectures. -android-all: $(ANDROID_ABIS) +android-all: android-lib-arm-v5 android-lib-arm-v7 android-lib-arm-v8 +android-all: android-lib-x86 android-lib-x86-64 +android-all: android-lib-mips android-lib-mips-64 cd android/java && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) -# Full build of GL Core for each architecture, build the Android Library, publish to Maven Central -android-deploy: $(ANDROID_ABIS) - cd android/java/MapboxGLAndroidSDK && chmod ugo+x deploy.sh && ./deploy.sh - -android-project: android-lib - - -##### Render builds ############################################################ - -render: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) mbgl-render +.PHONY: test +test: ; $(RUN) Makefile/test +test-%: ; $(RUN) test-$* +ifeq ($(BUILD),osx) +xtest: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/test +endif -.PHONY: xrender -xrender: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xrender: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target mbgl-render -jobs $(JOBS) $(XCPRETTY) +.PHONY: render xrender +render: ; $(RUN) Makefile/mbgl-render +ifeq ($(BUILD),osx) +xrender: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/mbgl-render +endif ##### Maintenace operations #################################################### .PHONY: clear_xcode_cache clear_xcode_cache: -ifeq ($(PLATFORM), osx) +ifeq ($(BUILD), osx) @CUSTOM_DD=`defaults read com.apple.dt.Xcode IDECustomDerivedDataLocation 2>/dev/null`; \ if [ $$CUSTOM_DD ]; then \ echo clearing files in $$CUSTOM_DD older than one day; \ @@ -233,7 +109,7 @@ endif .PHONY: clear_sqlite_cache clear_sqlite_cache: -ifeq ($(PLATFORM), osx) +ifeq ($(BUILD), osx) rm -f ~/Library/Application\ Support/Mapbox\ GL/cache.db else rm -f /tmp/mbgl-cache.db |