summaryrefslogtreecommitdiff
path: root/tagstats/Makefile
blob: 19e33cdf56feabe6c528fa48528f735d57f8e9dd (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
#------------------------------------------------------------------------------
#
#  Tagstats Makefile
#
#------------------------------------------------------------------------------

CXX = g++

#CXXFLAGS = -g
CXXFLAGS = -O3

CXXFLAGS += -Wall -Wextra -Wredundant-decls -Wdisabled-optimization -pedantic

CXXFLAGS += -DTAGSTATS_COUNT_USERS
CXXFLAGS += -DTAGSTATS_COUNT_KEY_COMBINATIONS
CXXFLAGS += -DTAGSTATS_COUNT_TAG_COMBINATIONS

CXXFLAGS += -DTAGSTATS_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]\)/_\0/g' | cut -c2- | tr 'A-Z' 'a-z')
BYID_INCL := "<osmium/storage/byid/$(BYID_LC).hpp>"

CXXFLAGS += -DTAGSTATS_GEODISTRIBUTION_FOR_WAYS=$(BYID)
CXXFLAGS += -DTAGSTATS_GEODISTRIBUTION_INCLUDE=$(BYID_INCL)

CXXFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

CXXFLAGS += `../bin/taginfo-config.rb tagstats.cxxflags`

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

LDFLAGS = $(LIB_EXPAT) $(LIB_PBF) $(LIB_GD) $(LIB_SQLITE)

.PHONY: all clean install

all: tagstats osmstats

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

tagstats: tagstats.cpp tagstats_handler.hpp statistics_handler.hpp string_store.hpp geodistribution.hpp
	$(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS)

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 core tagstats osmstats