summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3df03e09de2426df6c2add97462f61168d81baf4 (plain)
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
BUILDTYPE ?= Release
MBGL ?= vendor/mbgl

DEBUG_FLAG =
ifeq ($(BUILDTYPE), Debug)
DEBUG_FLAG = -d
endif

ifeq ($(shell uname -s), Darwin)
HOST ?= osx
ifeq ($(JOBS),)
JOBS = $(shell sysctl -n hw.ncpu)
endif
endif
ifeq ($(shell uname -s), Linux)
HOST ?= linux
ifeq ($(JOBS),)
JOBS = $(shell nproc)
endif
endif

# Explicitly disable the default FileSource implementation
ASSET = none
HTTP = none
CACHE = none

include $(MBGL)/config/defaults.mk

global: build

.PHONY: build
build: build/Makefile
	@node-gyp build $(DEBUG_FLAG) --clang -- -j$(JOBS)

.PHONY: vendor/mbgl
vendor/mbgl:
	git submodule update --init

.PHONY: build/Makefile
build/Makefile: $(MBGL)/config/$(HOST).gypi
	@node-gyp configure --clang -- \
		-Dmbgl=$(MBGL) \
		-Dhost=$(HOST) \
		-I$(MBGL)/config/$(HOST).gypi \
		$(LIBS_$(HOST)) \
		-Duv_static_libs= -Duv_ldflags= \
		-Goutput_dir=.

$(MBGL)/config/%.gypi: $(MBGL) $(MBGL)/configure
	make -C $(MBGL) config/$*.gypi

.PHONY: test-suite
test-suite: build
	@(`npm bin`/tape test/render.test.js || true)

.PHONY: test-js
test-js: build
	@`npm bin`/tape test/js/**/*.test.js

.PHONY: test
test: test-js test-suite

.PHONY: clean
clean:
	rm -rf build
	rm -f $(MBGL)/config/$(HOST).gypi