-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
59 lines (40 loc) · 1.78 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
CXXFLAGS += -Iinclude -std=c++11 -fPIC -fvisibility=hidden
RELEASE_FLAGS := -O3 -DNDEBUG
WARNING_FLAGS := -Wall -Wextra -pedantic -Wsign-compare -Wconversion -Wfloat-conversion -Wdouble-promotion -Wshadow
DEBUG_FLAGS := -g -O0 -DDEBUG -fno-inline-functions -fno-omit-frame-pointer
COMPILER_VERSION = $(shell $(CXX) -v 2>&1)
ifneq (,$(findstring clang,$(COMPILER_VERSION)))
WARNING_DISABLE := -Wno-c99-extensions -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-exit-time-destructors
PROFILING_FLAG := -gline-tables-only
endif
MASON ?= .mason/mason
BOOST_VERSION = 1.63.0
FREETYPE_VERSION = 2.6.5
MASON_INCLUDES = -isystem mason_packages/.link/include -isystem mason_packages/.link/include/freetype2
STATIC_LIBS = $(shell $(MASON) static_libs freetype $(FREETYPE_VERSION))
export BUILDTYPE ?= Release
ifeq ($(BUILDTYPE),Release)
FINAL_FLAGS := $(PROFILING_FLAG) $(WARNING_FLAGS) $(WARNING_DISABLE) $(RELEASE_FLAGS)
else
FINAL_FLAGS := -g $(WARNING_FLAGS) $(DEBUG_FLAGS)
endif
default: test
$(MASON):
git submodule update --init
mason_packages/.link/include/boost: $(MASON)
$(MASON) install boost $(BOOST_VERSION)
$(MASON) link boost $(BOOST_VERSION)
mason_packages/.link/include/freetype:
$(MASON) install freetype $(FREETYPE_VERSION)
$(MASON) link freetype $(FREETYPE_VERSION)
deps: mason_packages/.link/include/boost mason_packages/.link/include/freetype
build/$(BUILDTYPE):
mkdir -p build/$(BUILDTYPE)
build/$(BUILDTYPE)/test: test/test.cpp test/fonts/* test/fixtures/* deps include/mapbox/* include/agg/* build/$(BUILDTYPE)
$(CXX) $(CXXFLAGS) $(FINAL_FLAGS) $(MASON_INCLUDES) $< $(STATIC_LIBS) -lz -o $@
test: build/$(BUILDTYPE)/test
./build/$(BUILDTYPE)/test
format:
clang-format include/mapbox/*.hpp include/agg/*.h* src/glyph_foundry.cpp test/*.cpp -i
clean:
rm -rf build