summaryrefslogtreecommitdiff
path: root/tagstats/Makefile
blob: b266fe95a7b45c174bcb9b6fc34c0dca5eaa00fe (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
67
68
#------------------------------------------------------------------------------
#
#  Tagstats Makefile
#
#------------------------------------------------------------------------------
#
#  You can set several environment variables before running make if you don't
#  like the defaults:
#
#  CXX                - Your C++ compiler.
#  CPLUS_INCLUDE_PATH - Include file search path. This should include the
#                       directory where Osmium is.
#  CXXFLAGS           - Extra compiler flags.
#  LDFLAGS            - Extra linker flags.
#
#------------------------------------------------------------------------------

CXXFLAGS += -O3
#CXXFLAGS += -g
#CXXFLAGS += -g -pg
#CXXFLAGS += -g -fprofile-arcs -ftest-coverage
CXXFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CXXFLAGS += `../bin/taginfo-config.rb tagstats.cxxflags`

GEODISTRIBUTION_TYPE := $(shell ../bin/taginfo-config.rb tagstats.geodistribution_int uint16_t)
BYID := $(shell ../bin/taginfo-config.rb tagstats.geodistribution)
#BYID := SparseTable
#BYID := MmapFile
#BYID := MmapAnon
BYID_LC   := $(shell echo $(BYID) | sed -e 's/\([A-Z]\)/_\1/g' | cut -c2- | tr 'A-Z' 'a-z')
BYID_INCL := "<osmium/storage/byid/$(BYID_LC).hpp>"

CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_INT=$(GEODISTRIBUTION_TYPE)
CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_FOR_WAYS=$(BYID)
CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_INCLUDE=$(BYID_INCL)

CXXFLAGS_WARNINGS := -Wall -Wextra -Wredundant-decls -Wdisabled-optimization -pedantic

LIB_EXPAT  := -lexpat
LIB_PBF    := -pthread -lz -lprotobuf-lite -losmpbf
LIB_GD     := -lgd -lz -lm
LIB_SQLITE := -lsqlite3

.PHONY: all check indent install clean

all: tagstats osmstats similarity

osmstats: osmstats.cpp statistics_handler.hpp
	$(CXX) $(CXXFLAGS) $(CXXFLAGS_WARNINGS) -o $@ $< $(LDFLAGS) $(LIB_EXPAT) $(LIB_PBF) $(LIB_SQLITE)

tagstats: tagstats.cpp tagstats_handler.hpp statistics_handler.hpp string_store.hpp geodistribution.hpp sqlite.hpp
	$(CXX) $(CXXFLAGS) $(CXXFLAGS_WARNINGS) $(CXXFLAGS_FEATURES) -o $@ $< $(LDFLAGS) $(LIB_EXPAT) $(LIB_PBF) $(LIB_SQLITE) $(LIB_GD)

similarity: similarity.cpp sqlite.hpp
	$(CXX) $(CXXFLAGS) $(CXXFLAGS_WARNINGS) $(CXXFLAGS_FEATURES) -o $@ $< $(LDFLAGS) $(LIB_SQLITE)

check:
	cppcheck --enable=all tagstats.cpp osmstats.cpp

indent:
	astyle --style=java --indent-namespaces --indent-switches --pad-header --suffix=none \*.hpp \*.cpp

install:
	install -m 755 tagstats ../sources/db/tagstats

clean:
	rm -f *.o *.gcno *.gcda *.gcov gmon.out core tagstats osmstats similarity