2014-11-24 18:35:06 +00:00
|
|
|
PREFIX ?= /usr/local
|
2015-10-29 23:46:57 +00:00
|
|
|
MANDIR ?= $(PREFIX)/share/man/man1/
|
2016-04-26 22:39:42 +00:00
|
|
|
BUILDTYPE ?= Release
|
2016-07-13 20:00:38 +00:00
|
|
|
SHELL = /bin/bash
|
2014-02-22 00:55:36 +00:00
|
|
|
|
2015-12-23 00:26:24 +00:00
|
|
|
# inherit from env if set
|
|
|
|
CC := $(CC)
|
2016-03-24 21:36:36 +00:00
|
|
|
CXX := $(CXX)
|
2015-12-23 00:26:24 +00:00
|
|
|
CFLAGS := $(CFLAGS)
|
2017-01-26 21:25:06 +00:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -std=c++11
|
2015-12-23 00:26:24 +00:00
|
|
|
LDFLAGS := $(LDFLAGS)
|
2016-10-17 20:29:39 +00:00
|
|
|
WARNING_FLAGS := -Wall -Wshadow -Wsign-compare
|
2016-04-26 22:39:42 +00:00
|
|
|
RELEASE_FLAGS := -O3 -DNDEBUG
|
|
|
|
DEBUG_FLAGS := -O0 -DDEBUG -fno-inline-functions -fno-omit-frame-pointer
|
|
|
|
|
|
|
|
ifeq ($(BUILDTYPE),Release)
|
|
|
|
FINAL_FLAGS := -g $(WARNING_FLAGS) $(RELEASE_FLAGS)
|
|
|
|
else
|
|
|
|
FINAL_FLAGS := -g $(WARNING_FLAGS) $(DEBUG_FLAGS)
|
|
|
|
endif
|
2015-12-23 00:26:24 +00:00
|
|
|
|
2016-10-05 21:54:28 +00:00
|
|
|
all: tippecanoe tippecanoe-enumerate tippecanoe-decode tile-join unit
|
2015-07-28 19:48:49 +00:00
|
|
|
|
|
|
|
docs: man/tippecanoe.1
|
2014-02-22 00:55:36 +00:00
|
|
|
|
2015-11-30 19:10:19 +00:00
|
|
|
install: tippecanoe tippecanoe-enumerate tippecanoe-decode tile-join
|
2014-12-02 19:38:48 +00:00
|
|
|
mkdir -p $(PREFIX)/bin
|
2015-10-29 23:46:57 +00:00
|
|
|
mkdir -p $(MANDIR)
|
2014-09-26 21:53:10 +00:00
|
|
|
cp tippecanoe $(PREFIX)/bin/tippecanoe
|
2015-11-03 22:04:28 +00:00
|
|
|
cp tippecanoe-enumerate $(PREFIX)/bin/tippecanoe-enumerate
|
|
|
|
cp tippecanoe-decode $(PREFIX)/bin/tippecanoe-decode
|
|
|
|
cp tile-join $(PREFIX)/bin/tile-join
|
2015-10-29 23:46:57 +00:00
|
|
|
cp man/tippecanoe.1 $(MANDIR)/tippecanoe.1
|
2014-02-06 06:04:58 +00:00
|
|
|
|
2016-12-13 22:16:32 +00:00
|
|
|
uninstall:
|
|
|
|
rm $(PREFIX)/bin/tippecanoe $(PREFIX)/bin/tippecanoe-enumerate $(PREFIX)/bin/tippecanoe-decode $(PREFIX)/bin/tile-join $(MANDIR)/tippecanoe.1
|
|
|
|
|
2015-05-29 16:06:41 +00:00
|
|
|
man/tippecanoe.1: README.md
|
|
|
|
md2man-roff README.md > man/tippecanoe.1
|
|
|
|
|
2014-09-18 23:23:36 +00:00
|
|
|
PG=
|
|
|
|
|
2016-04-27 20:55:28 +00:00
|
|
|
H = $(wildcard *.h) $(wildcard *.hpp)
|
|
|
|
C = $(wildcard *.c) $(wildcard *.cpp)
|
2014-10-27 16:52:25 +00:00
|
|
|
|
2016-04-23 00:10:33 +00:00
|
|
|
INCLUDES = -I/usr/local/include -I.
|
2014-11-16 07:46:39 +00:00
|
|
|
LIBS = -L/usr/local/lib
|
|
|
|
|
2016-12-07 22:29:09 +00:00
|
|
|
tippecanoe: geojson.o jsonpull/jsonpull.o tile.o pool.o mbtiles.o geometry.o projection.o memfile.o mvt.o serial.o main.o text.o
|
2016-04-26 22:39:42 +00:00
|
|
|
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
2014-09-15 22:18:08 +00:00
|
|
|
|
2015-11-03 22:04:28 +00:00
|
|
|
tippecanoe-enumerate: enumerate.o
|
2016-10-12 21:07:41 +00:00
|
|
|
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) -lsqlite3
|
2014-10-23 21:04:57 +00:00
|
|
|
|
2016-04-23 00:45:06 +00:00
|
|
|
tippecanoe-decode: decode.o projection.o mvt.o
|
2016-04-26 22:39:42 +00:00
|
|
|
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3
|
2014-10-23 22:40:27 +00:00
|
|
|
|
2016-04-27 21:59:20 +00:00
|
|
|
tile-join: tile-join.o projection.o pool.o mbtiles.o mvt.o memfile.o
|
2016-09-20 23:00:03 +00:00
|
|
|
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
2015-08-20 20:02:34 +00:00
|
|
|
|
2016-10-05 21:54:28 +00:00
|
|
|
unit: unit.o text.o
|
|
|
|
$(CXX) $(PG) $(LIBS) $(FINAL_FLAGS) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) -lm -lz -lsqlite3 -lpthread
|
|
|
|
|
2016-10-12 20:21:29 +00:00
|
|
|
-include $(wildcard *.d)
|
2014-09-22 17:44:30 +00:00
|
|
|
|
2016-10-12 20:21:29 +00:00
|
|
|
%.o: %.c
|
|
|
|
$(CC) -MMD $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) -MMD $(PG) $(INCLUDES) $(FINAL_FLAGS) $(CXXFLAGS) -c -o $@ $<
|
2016-04-27 19:25:03 +00:00
|
|
|
|
2014-09-26 21:53:10 +00:00
|
|
|
clean:
|
2016-12-07 00:52:37 +00:00
|
|
|
rm -f ./tippecanoe ./tippecanoe-* ./tile-join ./unit *.o *.d */*.o */*.d
|
2015-06-03 18:21:40 +00:00
|
|
|
|
|
|
|
indent:
|
2016-06-16 19:33:38 +00:00
|
|
|
clang-format -i -style="{BasedOnStyle: Google, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, ColumnLimit: 0, ContinuationIndentWidth: 8, SpaceAfterCStyleCast: true, IndentCaseLabels: false, AllowShortBlocksOnASingleLine: false, AllowShortFunctionsOnASingleLine: false, SortIncludes: false}" $(C) $(H)
|
2016-01-28 18:52:43 +00:00
|
|
|
|
|
|
|
TESTS = $(wildcard tests/*/out/*.json)
|
|
|
|
SPACE = $(NULL) $(NULL)
|
|
|
|
|
2017-03-02 00:01:57 +00:00
|
|
|
test: tippecanoe tippecanoe-decode $(addsuffix .check,$(TESTS)) parallel-test pbf-test join-test enumerate-test decode-test unit
|
2016-10-05 21:54:28 +00:00
|
|
|
./unit
|
2016-01-28 18:52:43 +00:00
|
|
|
|
2016-03-29 22:01:03 +00:00
|
|
|
# Work around Makefile and filename punctuation limits: _ for space, @ for :, % for /
|
2016-01-28 18:52:43 +00:00
|
|
|
%.json.check:
|
2016-11-04 19:26:13 +00:00
|
|
|
./tippecanoe -aD -f -o $@.mbtiles $(subst @,:,$(subst %,/,$(subst _, ,$(patsubst %.json.check,%,$(word 4,$(subst /, ,$@)))))) $(wildcard $(subst $(SPACE),/,$(wordlist 1,2,$(subst /, ,$@)))/*.json) < /dev/null
|
2016-01-28 18:57:55 +00:00
|
|
|
./tippecanoe-decode $@.mbtiles > $@.out
|
|
|
|
cmp $(patsubst %.check,%,$@) $@.out
|
2016-01-28 18:52:43 +00:00
|
|
|
rm $@.out $@.mbtiles
|
2016-01-28 22:06:51 +00:00
|
|
|
|
2016-02-02 20:21:19 +00:00
|
|
|
parallel-test:
|
|
|
|
mkdir -p tests/parallel
|
2016-04-28 21:43:04 +00:00
|
|
|
perl -e 'for ($$i = 0; $$i < 20; $$i++) { $$lon = rand(360) - 180; $$lat = rand(180) - 90; print "{ \"type\": \"Feature\", \"properties\": { \"yes\": \"no\", \"who\": 1 }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ $$lon, $$lat ] } }\n"; }' > tests/parallel/in1.json
|
2016-02-02 23:43:27 +00:00
|
|
|
perl -e 'for ($$i = 0; $$i < 300000; $$i++) { $$lon = rand(360) - 180; $$lat = rand(180) - 90; print "{ \"type\": \"Feature\", \"properties\": { }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ $$lon, $$lat ] } }\n"; }' > tests/parallel/in2.json
|
|
|
|
perl -e 'for ($$i = 0; $$i < 20; $$i++) { $$lon = rand(360) - 180; $$lat = rand(180) - 90; print "{ \"type\": \"Feature\", \"properties\": { }, \"geometry\": { \"type\": \"Point\", \"coordinates\": [ $$lon, $$lat ] } }\n"; }' > tests/parallel/in3.json
|
2016-07-13 20:00:38 +00:00
|
|
|
echo -n "" > tests/parallel/empty1.json
|
|
|
|
echo "" > tests/parallel/empty2.json
|
|
|
|
./tippecanoe -z5 -f -pi -l test -n test -o tests/parallel/linear-file.mbtiles tests/parallel/in[123].json tests/parallel/empty[12].json
|
|
|
|
./tippecanoe -z5 -f -pi -l test -n test -P -o tests/parallel/parallel-file.mbtiles tests/parallel/in[123].json tests/parallel/empty[12].json
|
2016-02-02 23:43:27 +00:00
|
|
|
cat tests/parallel/in[123].json | ./tippecanoe -z5 -f -pi -l test -n test -o tests/parallel/linear-pipe.mbtiles
|
|
|
|
cat tests/parallel/in[123].json | ./tippecanoe -z5 -f -pi -l test -n test -P -o tests/parallel/parallel-pipe.mbtiles
|
2016-07-13 20:00:38 +00:00
|
|
|
./tippecanoe -z5 -f -pi -l test -n test -P -o tests/parallel/parallel-pipes.mbtiles <(cat tests/parallel/in1.json) <(cat tests/parallel/empty1.json) <(cat tests/parallel/empty2.json) <(cat tests/parallel/in2.json) /dev/null <(cat tests/parallel/in3.json)
|
2016-02-02 20:21:19 +00:00
|
|
|
./tippecanoe-decode tests/parallel/linear-file.mbtiles > tests/parallel/linear-file.json
|
|
|
|
./tippecanoe-decode tests/parallel/parallel-file.mbtiles > tests/parallel/parallel-file.json
|
|
|
|
./tippecanoe-decode tests/parallel/linear-pipe.mbtiles > tests/parallel/linear-pipe.json
|
|
|
|
./tippecanoe-decode tests/parallel/parallel-pipe.mbtiles > tests/parallel/parallel-pipe.json
|
2016-07-13 20:00:38 +00:00
|
|
|
./tippecanoe-decode tests/parallel/parallel-pipes.mbtiles > tests/parallel/parallel-pipes.json
|
2016-02-02 20:21:19 +00:00
|
|
|
cmp tests/parallel/linear-file.json tests/parallel/parallel-file.json
|
|
|
|
cmp tests/parallel/linear-file.json tests/parallel/linear-pipe.json
|
|
|
|
cmp tests/parallel/linear-file.json tests/parallel/parallel-pipe.json
|
2016-07-13 20:00:38 +00:00
|
|
|
cmp tests/parallel/linear-file.json tests/parallel/parallel-pipes.json
|
2016-02-02 20:21:19 +00:00
|
|
|
rm tests/parallel/*.mbtiles tests/parallel/*.json
|
|
|
|
|
2017-03-02 00:01:57 +00:00
|
|
|
decode-test:
|
|
|
|
mkdir -p tests/muni/decode
|
|
|
|
./tippecanoe -z11 -Z11 -f -o tests/muni/decode/multi.mbtiles tests/muni/*.json
|
|
|
|
./tippecanoe-decode -l subway tests/muni/decode/multi.mbtiles > tests/muni/decode/multi.mbtiles.json.check
|
|
|
|
cmp tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles.json
|
|
|
|
rm -f tests/muni/decode/multi.mbtiles.json.check tests/muni/decode/multi.mbtiles
|
|
|
|
|
2016-03-23 00:12:09 +00:00
|
|
|
pbf-test:
|
|
|
|
./tippecanoe-decode tests/pbf/11-328-791.vector.pbf 11 328 791 > tests/pbf/11-328-791.vector.pbf.out
|
|
|
|
cmp tests/pbf/11-328-791.json tests/pbf/11-328-791.vector.pbf.out
|
|
|
|
rm tests/pbf/11-328-791.vector.pbf.out
|
2016-06-28 22:18:27 +00:00
|
|
|
./tippecanoe-decode -t EPSG:3857 tests/pbf/11-328-791.vector.pbf 11 328 791 > tests/pbf/11-328-791.3857.vector.pbf.out
|
|
|
|
cmp tests/pbf/11-328-791.3857.json tests/pbf/11-328-791.3857.vector.pbf.out
|
|
|
|
rm tests/pbf/11-328-791.3857.vector.pbf.out
|
2016-03-23 00:12:09 +00:00
|
|
|
|
2016-10-12 23:26:36 +00:00
|
|
|
enumerate-test:
|
|
|
|
./tippecanoe -z5 -f -o tests/ne_110m_admin_0_countries/out/enum.mbtiles tests/ne_110m_admin_0_countries/in.json
|
|
|
|
./tippecanoe-enumerate tests/ne_110m_admin_0_countries/out/enum.mbtiles > tests/ne_110m_admin_0_countries/out/enum.check
|
|
|
|
cmp tests/ne_110m_admin_0_countries/out/enum tests/ne_110m_admin_0_countries/out/enum.check
|
|
|
|
rm tests/ne_110m_admin_0_countries/out/enum.mbtiles tests/ne_110m_admin_0_countries/out/enum.check
|
|
|
|
|
2016-05-03 18:30:53 +00:00
|
|
|
join-test:
|
2016-09-20 22:53:10 +00:00
|
|
|
./tippecanoe -f -z12 -o tests/join-population/tabblock_06001420.mbtiles tests/join-population/tabblock_06001420.json
|
|
|
|
./tippecanoe -f -z12 -o tests/join-population/tabblock_06001420.mbtiles tests/join-population/tabblock_06001420.json
|
|
|
|
./tippecanoe -f -Z5 -z10 -o tests/join-population/macarthur.mbtiles -l macarthur tests/join-population/macarthur.json
|
|
|
|
./tippecanoe -f -d10 -D10 -Z9 -z11 -o tests/join-population/macarthur2.mbtiles -l macarthur tests/join-population/macarthur2.json
|
2016-05-03 18:30:53 +00:00
|
|
|
./tile-join -f -o tests/join-population/joined.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles
|
|
|
|
./tile-join -f -i -o tests/join-population/joined-i.mbtiles -x GEOID10 -c tests/join-population/population.csv tests/join-population/tabblock_06001420.mbtiles
|
2016-09-20 22:53:10 +00:00
|
|
|
./tile-join -f -o tests/join-population/merged.mbtiles tests/join-population/tabblock_06001420.mbtiles tests/join-population/macarthur.mbtiles tests/join-population/macarthur2.mbtiles
|
2016-12-13 22:16:32 +00:00
|
|
|
./tile-join -f -c tests/join-population/windows.csv -o tests/join-population/windows.mbtiles tests/join-population/macarthur.mbtiles
|
2017-01-24 22:14:10 +00:00
|
|
|
./tippecanoe-decode -z11 -Z4 tests/join-population/joined.mbtiles > tests/join-population/joined.mbtiles.json.check
|
2016-05-03 18:30:53 +00:00
|
|
|
./tippecanoe-decode tests/join-population/joined-i.mbtiles > tests/join-population/joined-i.mbtiles.json.check
|
2016-09-20 22:53:10 +00:00
|
|
|
./tippecanoe-decode tests/join-population/merged.mbtiles > tests/join-population/merged.mbtiles.json.check
|
2016-12-13 22:16:32 +00:00
|
|
|
./tippecanoe-decode tests/join-population/windows.mbtiles > tests/join-population/windows.mbtiles.json.check
|
2016-05-03 18:30:53 +00:00
|
|
|
cmp tests/join-population/joined.mbtiles.json.check tests/join-population/joined.mbtiles.json
|
|
|
|
cmp tests/join-population/joined-i.mbtiles.json.check tests/join-population/joined-i.mbtiles.json
|
2016-09-20 22:53:10 +00:00
|
|
|
cmp tests/join-population/merged.mbtiles.json.check tests/join-population/merged.mbtiles.json
|
2016-12-13 22:16:32 +00:00
|
|
|
cmp tests/join-population/windows.mbtiles.json.check tests/join-population/windows.mbtiles.json
|
|
|
|
rm tests/join-population/tabblock_06001420.mbtiles tests/join-population/joined.mbtiles tests/join-population/joined-i.mbtiles tests/join-population/joined.mbtiles.json.check tests/join-population/joined-i.mbtiles.json.check tests/join-population/macarthur.mbtiles tests/join-population/merged.mbtiles tests/join-population/merged.mbtiles.json.check tests/join-population/macarthur2.mbtiles tests/join-population/windows.mbtiles tests/join-population/windows.mbtiles.json.check
|
2016-05-03 18:30:53 +00:00
|
|
|
|
2016-01-28 22:06:51 +00:00
|
|
|
# Use this target to regenerate the standards that the tests are compared against
|
|
|
|
# after making a change that legitimately changes their output
|
|
|
|
|
|
|
|
prep-test: $(TESTS)
|
|
|
|
|
|
|
|
tests/%.json: Makefile tippecanoe tippecanoe-decode
|
2016-03-29 22:01:03 +00:00
|
|
|
./tippecanoe -f -o $@.check.mbtiles $(subst @,:,$(subst %,/,$(subst _, ,$(patsubst %.json,%,$(word 4,$(subst /, ,$@)))))) $(wildcard $(subst $(SPACE),/,$(wordlist 1,2,$(subst /, ,$@)))/*.json)
|
2016-01-28 22:38:10 +00:00
|
|
|
./tippecanoe-decode $@.check.mbtiles > $@
|
2016-01-28 22:06:51 +00:00
|
|
|
cmp $(patsubst %.check,%,$@) $@
|
2016-01-28 22:38:10 +00:00
|
|
|
rm $@.check.mbtiles
|