-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
43 lines (30 loc) · 1.25 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
CXXFLAGS += -I include -std=c++14 -Wall -Wextra -Wshadow -Werror -O3 -fPIC
MASON ?= .mason/mason
VARIANT = variant 1.1.4
GEOMETRY = geometry 1.1.0
RAPIDJSON = rapidjson 1.1.0
DEPS = `$(MASON) cflags $(VARIANT)` `$(MASON) cflags $(GEOMETRY)`
RAPIDJSON_DEP = `$(MASON) cflags $(RAPIDJSON)`
default: build/libgeojson.a
mason_packages/headers/geometry:
$(MASON) install $(VARIANT)
$(MASON) install $(GEOMETRY)
$(MASON) install $(RAPIDJSON)
build:
mkdir -p build
CFLAGS += -fvisibility=hidden
build/geojson.o: src/mapbox/geojson.cpp include/mapbox/geojson.hpp include/mapbox/geojson_impl.hpp include/mapbox/geojson_value_impl.hpp build mason_packages/headers/geometry Makefile
$(CXX) $(CFLAGS) $(CXXFLAGS) $(DEPS) $(RAPIDJSON_DEP) -c $< -o $@
build/libgeojson.a: build/geojson.o
$(AR) -rcs $@ $<
build/test: test/test.cpp test/fixtures/* build/libgeojson.a
$(CXX) $(CFLAGS) $(CXXFLAGS) $(DEPS) $(RAPIDJSON_DEP) $< -Lbuild -lgeojson -o $@
build/test_value: test/test_value.cpp test/fixtures/* build/libgeojson.a
$(CXX) $(CFLAGS) $(CXXFLAGS) $(DEPS) $(RAPIDJSON_DEP) $< -Lbuild -lgeojson -o $@
test: build/test build/test_value
./build/test
./build/test_value
format:
clang-format include/mapbox/*.hpp src/mapbox/geojson.cpp test/*.cpp -i
clean:
rm -rf build