-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
77 lines (65 loc) · 2.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
export BUILDTYPE ?= Debug
buildtype := $(shell echo "$(BUILDTYPE)" | tr "[A-Z]" "[a-z]")
export BUILDDIR ?= build/default/$(buildtype)
ifeq ($(shell uname -s), Darwin)
export JOBS ?= $(shell sysctl -n hw.ncpu)
else ifeq ($(shell uname -s), Linux)
export JOBS ?= $(shell grep --count processor /proc/cpuinfo)
else
$(error Cannot determine host platform)
endif
.PHONY: all
all: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS)
.PHONY: test
test: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS) -- test-map
.PHONY: run-test
run-test: test
"$(BUILDDIR)/test/test-map" yellow
.PHONY: benchmark
benchmark: $(BUILDDIR)/Makefile
cmake --build "$(BUILDDIR)" -j $(JOBS) -- benchmark-map
.PHONY: run-benchmark
run-benchmark: benchmark
"$(BUILDDIR)/test/benchmark-map"
.PRECIOUS: $(BUILDDIR)/Makefile
$(BUILDDIR)/Makefile:
mkdir -p $(BUILDDIR)
cmake -H. -B$(BUILDDIR) -DCMAKE_BUILD_TYPE=$(BUILDTYPE)
.PRECIOUS: build/android-%/build.ninja
build/android-%/build.ninja: CMAKE = $(shell which $(ANDROID_HOME)/cmake/*/bin/cmake)
build/android-%/build.ninja: NINJA = $(shell which $(ANDROID_HOME)/cmake/*/bin/ninja)
build/android-%/build.ninja:
mkdir -p build/android-$*
$(CMAKE) -H. -Bbuild/android-$* \
-GNinja \
-DCMAKE_BUILD_TYPE=$(BUILDTYPE) \
-DCMAKE_MAKE_PROGRAM=$(NINJA) \
-DCMAKE_TOOLCHAIN_FILE=$(ANDROID_HOME)/ndk-bundle/build/cmake/android.toolchain.cmake \
-DWITH_BENCHMARKS=OFF \
-DANDROID_ABI=$* \
-DANDROID_PLATFORM=android-14 \
-DANDROID_NDK=$(ANDROID_HOME)/ndk-bundle \
-DANDROID_TOOLCHAIN=clang \
-DANDROID_STL=c++_static
.PHONY: android-all
android-all: android-armeabi-v7a
android-all: android-arm64-v8a
android-all: android-x86
android-all: android-x86_64
android-%: build/android-%/build.ninja
cmake --build build/android-$* -j $(JOBS)
.PHONY: docker-all
docker-all: docker-linux-gcc-4.9
docker-all: docker-linux-gcc-5
docker-all: docker-linux-gcc-6
docker-all: docker-linux-gcc-7
docker-all: docker-linux-gcc-8
docker-all: docker-linux-clang-3.9
docker-all: docker-linux-clang-4
docker-all: docker-linux-clang-5
docker-all: docker-linux-clang-6
docker-all: docker-linux-clang-7
docker-linux-%:
docker run -v `pwd`:/src --rm -e=BUILDTYPE=$(BUILDTYPE) -e=BUILDDIR=build/linux-$*/$(buildtype) -it mbgl/linux-$* make run-test run-benchmark