summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-03 15:16:49 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-07 18:01:02 -0700
commitf964e40e7e9220d08751d8607af61ac5a7c0794c (patch)
treed34ca5407188fe3d71396faa8a8acceb52d9bd4b /Makefile
parentf5d66f362272db034a311d2077dbdb2937c9bbdf (diff)
downloadqtlocation-mapboxgl-f964e40e7e9220d08751d8607af61ac5a7c0794c.tar.gz
[build] Refactor and simplify build system
* Main gyp files are now standardized as platform/<platform>/platform.gyp. * Each platform gyp file defines appropriate loop_lib and headless_lib variables. * Each platform gyp file includes mbgl.gypi, which defines base targets which may be useful to all platforms. * CI targets are consistent across platforms: `make $(PLATFORM) && make test-$(PLATFORM)`. * Renamed the "linux" test app to "glfw". It's now built in OS X CI. * Android build flakiness is fixed. * iOS CI builds the bench and iosapp targets. * Mesa version is now in one place. * CI scripts use bash "strict mode" and correct error handling. * All build output goes to the build directory. * Removed vestigial iOS/OS X/Android Travis scripts.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile202
1 files changed, 73 insertions, 129 deletions
diff --git a/Makefile b/Makefile
index f9dc5b4981..4ea77aa310 100644
--- a/Makefile
+++ b/Makefile
@@ -1,147 +1,92 @@
export BUILDTYPE ?= Release
-export BUILD_TEST ?= 1
-export BUILD_RENDER ?= 1
-export BUILD_OFFLINE ?= 1
export ENABLE_COVERAGE ?= 0
-# Determine build platform
ifeq ($(shell uname -s), Darwin)
-export BUILD = osx
-export JOBS ?= $(shell sysctl -n hw.ncpu)
+ export JOBS ?= $(shell sysctl -n hw.ncpu)
else ifeq ($(shell uname -s), Linux)
-export BUILD = linux
-export JOBS ?= $(shell grep --count processor /proc/cpuinfo)
+ export JOBS ?= $(shell grep --count processor /proc/cpuinfo)
else
-$(error Cannot determine build platform)
+ $(error Cannot determine host platform)
endif
-export BUILD_VERSION = $(shell uname -m)
-
-RUN = +$(MAKE) -f scripts/main.mk
+RUN = +$(MAKE) -f scripts/main.mk
default:
@printf "You must specify a valid target\n"
#### OS X targets ##############################################################
-.PHONY: osx
-osx:
- $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/osxapp
-
-.PHONY: run-osx
-run-osx: osx
- "gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL"
-
-.PHONY: Xcode/osx
-Xcode/osx:
- $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/__project__
+OSX_PROJ_PATH = build/osx-x86_64/platform/osx/platform.xcodeproj
-.PHONY: xproj
-xproj: Xcode/osx
- open ./build/osx-x86_64/gyp/osx.xcodeproj
+osx:
+ $(RUN) PLATFORM=osx Xcode/All
-.PHONY: xpackage
-xpackage: Xcode/osx
- ./platform/osx/scripts/package.sh
+$(OSX_PROJ_PATH):
+ $(RUN) PLATFORM=osx Xcode/__project__
-.PHONY: xpackage-strip
-xpackage-strip: Xcode/osx
- ./platform/osx/scripts/package.sh strip
+xproj: $(OSX_PROJ_PATH)
+ open $(OSX_PROJ_PATH)
-.PHONY: xtest
-xtest:
- $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/test
+$(OSX_PROJ_PATH)/xcshareddata/xcschemes/osxtest.xcscheme: platform/osx/scripts/osxtest.xcscheme $(OSX_PROJ_PATH)
+ mkdir -p $(basename $@)
+ cp $< $@
-.PHONY: xctest
-xctest: Xcode/osx
- ./platform/osx/scripts/test.sh
+test-osx: $(OSX_PROJ_PATH)/xcshareddata/xcschemes/osxtest.xcscheme node_modules/express
+ xcodebuild -project $(OSX_PROJ_PATH) -configuration $(BUILDTYPE) -target test build
+ build/osx-x86_64/$(BUILDTYPE)/test
+ xcodebuild -project $(OSX_PROJ_PATH) -configuration $(BUILDTYPE) -scheme osxtest test
#### iOS targets ##############################################################
-.PHONY: Xcode/ios
-Xcode/ios:
- $(RUN) HOST=ios Xcode/__project__
-
-.PHONY: iproj
-iproj: Xcode/ios
- open ./build/ios-all/gyp/ios.xcodeproj
+IOS_PROJ_PATH = build/ios-all/platform/ios/platform.xcodeproj
-.PHONY: ios
ios:
- $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphoneos ARCHS="arm64 armv7 armv7s"' Xcode/iosapp
+ $(RUN) PLATFORM=ios Xcode/All
-.PHONY: isim
-isim:
- $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphonesimulator ARCHS="x86_64 i386"' Xcode/iosapp
+$(IOS_PROJ_PATH):
+ $(RUN) PLATFORM=ios Xcode/__project__
-.PHONY: ibench
-ibench:
- $(RUN) HOST=ios XCODEBUILD_ARGS='-sdk iphoneos ARCHS="arm64"' Xcode/ios-bench
+iproj: $(IOS_PROJ_PATH)
+ open $(IOS_PROJ_PATH)
-.PHONY: ipackage
-ipackage: Xcode/ios
+test-ios:
+ # Currently nothing
+
+ipackage: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
-.PHONY: ipackage-strip
-ipackage-strip: Xcode/ios
+ipackage-strip: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
-.PHONY: ipackage-sim
-ipackage-sim: Xcode/ios
+ipackage-sim: $(IOS_PROJ_PATH)
BUILDTYPE=Debug BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=false SYMBOLS=$(SYMBOLS) \
BUNDLE_RESOURCES=YES PLACE_RESOURCE_BUNDLES_OUTSIDE_FRAMEWORK=YES \
./platform/ios/scripts/package.sh
-.PHONY: iframework
-iframework: Xcode/ios
+iframework: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=dynamic BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \
./platform/ios/scripts/package.sh
-.PHONY: ifabric
-ifabric: Xcode/ios
+ifabric: $(IOS_PROJ_PATH)
BITCODE=$(BITCODE) FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=NO BUNDLE_RESOURCES=YES \
./platform/ios/scripts/package.sh
-.PHONY: itest
-itest: ipackage-sim
- ./platform/ios/scripts/test.sh
-
-.PHONY: idocument
idocument:
OUTPUT=$(OUTPUT) ./platform/ios/scripts/document.sh
-#### Linux targets #####################################################
-
-.PHONY: linux
-linux:
- $(RUN) Makefile/linuxapp
-
-.PHONY: nlinux
-nlinux:
- $(RUN) Ninja/linuxapp
-
-.PHONY: run-linux
-run-linux: linux
- (cd build/$(BUILD)-$(BUILD_VERSION)/$(BUILDTYPE) && ./mapbox-gl)
-
-.PHONY: run-valgrind-linux
-run-valgrind-linux: linux
- (cd build/$(BUILD)-$(BUILD_VERSION)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup ./mapbox-gl)
-
#### Android targets #####################################################
# Builds a particular android architecture.
android-lib-%:
- $(RUN) HOST=android HOST_VERSION=$* Makefile/androidapp
+ $(RUN) PLATFORM=android SUBPLATFORM=$* Makefile/all
# Builds the default Android library
.PHONY: android-lib
-android-lib:
- $(RUN) HOST=android Makefile/androidapp
+android-lib: android-lib-arm-v7
# Builds the selected/default Android library
.PHONY: android
@@ -153,42 +98,64 @@ android: android-lib
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)
+test-android:
+ cd platform/android && ./gradlew testReleaseUnitTest --continue
+
#### Node targets #####################################################
-# Builds the Node.js library
-.PHONY: node
-node:
- $(RUN) LOOP=uv HTTP=none ASSET=none Makefile/node
+node_modules: package.json
+ npm update # Install dependencies but don't run our own install script.
-.PHONY: Xcode/node
-Xcode/node:
- $(RUN) LOOP=uv HTTP=none ASSET=none Xcode/node
+.PHONY: node
+node: node_modules
+ $(RUN) PLATFORM=node Makefile/node
.PHONY: xnode
-xnode: Xcode/node
+xnode:
+ $(RUN) Xcode/node
+ ./platform/node/scripts/create_node_scheme.sh "node test" "`npm bin tape`/tape platform/node/test/js/**/*.test.js"
+ ./platform/node/scripts/create_node_scheme.sh "npm run test-suite" "platform/node/test/render.test.js"
open ./build/binding.xcodeproj
-.PHONY: nproj
-nproj:
- $(RUN) LOOP=uv HTTP=none ASSET=none node/xproj
- open ./build/binding.xcodeproj
+.PHONY: test-node
+test-node: node
+ npm test
+ npm run test-suite
#### Miscellaneous targets #####################################################
+.PHONY: linux
+linux: glfw-app render offline
+
+.PHONY: test-linux
+test-linux: test-*
+
+.PHONY: glfw-app
+glfw-app:
+ $(RUN) Makefile/glfw-app
+
+.PHONY: run-glfw-app
+run-glfw-app:
+ $(RUN) run-glfw-app
+
+.PHONY: run-valgrind-glfw-app
+run-valgrind-glfw-app:
+ $(RUN) run-valgrind-glfw-app
+
.PHONY: test
test:
$(RUN) Makefile/test
-test-%:
+test-%: node_modules/express
$(RUN) test-$*
+node_modules/express:
+ npm install express@4.11.1
+
.PHONY: check
check:
$(RUN) BUILDTYPE=Debug ENABLE_COVERAGE=1 check
-coveralls:
- $(RUN) BUILDTYPE=Debug ENABLE_COVERAGE=1 coveralls
-
.PHONY: render
render:
$(RUN) Makefile/mbgl-render
@@ -197,10 +164,6 @@ render:
offline:
$(RUN) Makefile/mbgl-offline
-.PHONY: config
-config:
- $(RUN) config
-
# Generates a compilation database with ninja for use in clang tooling
.PHONY: compdb
compdb:
@@ -210,32 +173,13 @@ compdb:
tidy:
$(RUN) tidy
-.PHONY: clear_xcode_cache
-clear_xcode_cache:
-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; \
- find $$CUSTOM_DD/mapboxgl-app-* -mtime +1 | xargs rm -rf; \
- find $$CUSTOM_DD/osxapp-* -mtime +1 | xargs rm -rf; \
- fi; \
- if [ -d ~/Library/Developer/Xcode/DerivedData/ ] && [ ! $$CUSTOM_DD ]; then \
- echo 'clearing files in ~/Library/Developer/Xcode/DerivedData/{mapboxgl-app,osxapp}-* older than one day'; \
- find ~/Library/Developer/Xcode/DerivedData/mapboxgl-app-* -mtime +1 | xargs rm -rf; \
- find ~/Library/Developer/Xcode/DerivedData/osxapp-* -mtime +1 | xargs rm -rf; \
- fi
-endif
-
-clean: clear_xcode_cache
+clean:
-find ./deps/gyp -name "*.pyc" -exec rm {} \;
-find ./build -type f -not -path '*/*.xcodeproj/*' -exec rm {} \;
- -rm -rf ./gyp/build/
- -rm -rf ./config/*.gypi
-rm -rf ./platform/android/MapboxGLAndroidSDK/build \
./platform/android/MapboxGLAndroidSDKTestApp/build \
./platform/android/MapboxGLAndroidSDK/src/main/jniLibs \
./platform/android/MapboxGLAndroidSDKTestApp/src/main/jniLibs \
- ./platform/android/MapboxGLAndroidSDK/src/main/obj.target \
./platform/android/MapboxGLAndroidSDK/src/main/assets
distclean: clean