-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
132 lines (98 loc) · 4.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
SED=sed -i ""
else
SED=sed -i
endif
CPP=gcc -E -x c
#if the preprocessor fails for some reason, try replacing this with "cpp" on linux, or "cpp-4.2" on darwin (not available starting with mountain lion)
OSM_PREFIX?=osm_
OSM_NAME_COLUMN?=name
#OSM_SRID?=4326
#OSM_UNITS?=dd
#OSM_EXTENT?=-180 -90 180 90
OSM_SRID?=3857
OSM_UNITS?=meters
OSM_DB_CONNECTION?=host=localhost dbname=osm user=osm password=osm port=5432
OSM_SCHEMA?=public
OSM_EXTENT?=-20000000 -20000000 20000000 20000000
OSM_FORCE_POSTGIS_EXTENT?=0
OSM_WMS_SRS?=EPSG:900913 EPSG:4326 EPSG:3857 EPSG:2154 EPSG:310642901 EPSG:4171 EPSG:310024802 EPSG:310915814 EPSG:310486805 EPSG:310702807 EPSG:310700806 EPSG:310547809 EPSG:310706808 EPSG:310642810 EPSG:310642801 EPSG:310642812 EPSG:310032811 EPSG:310642813 EPSG:2986 EPSG:3035
DEBUG?=1
LAYERDEBUG?=1
PROJ_LIB?=`pwd`
STYLE?=default
#can also use google or bing
template=osmbase.map
tpl_configfile=config.conf.tpl
includes=land.map landusage.map borders.map highways.map places.map \
generated/$(STYLE)style.msinc \
generated/$(STYLE)level0.msinc generated/$(STYLE)level1.msinc generated/$(STYLE)level2.msinc generated/$(STYLE)level3.msinc \
generated/$(STYLE)level4.msinc generated/$(STYLE)level5.msinc generated/$(STYLE)level6.msinc generated/$(STYLE)level7.msinc \
generated/$(STYLE)level8.msinc generated/$(STYLE)level9.msinc generated/$(STYLE)level10.msinc generated/$(STYLE)level11.msinc \
generated/$(STYLE)level12.msinc generated/$(STYLE)level13.msinc generated/$(STYLE)level14.msinc generated/$(STYLE)level15.msinc \
generated/$(STYLE)level16.msinc generated/$(STYLE)level17.msinc generated/$(STYLE)level18.msinc
mapfile=osm-$(STYLE).map
configfile=config.conf
all:$(mapfile) boundaries.sql
generated/$(STYLE)style.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -g > $@
generated/$(STYLE)level0.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 0 > $@
generated/$(STYLE)level1.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 1 > $@
generated/$(STYLE)level2.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 2 > $@
generated/$(STYLE)level3.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 3 > $@
generated/$(STYLE)level4.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 4 > $@
generated/$(STYLE)level5.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 5 > $@
generated/$(STYLE)level6.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 6 > $@
generated/$(STYLE)level7.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 7 > $@
generated/$(STYLE)level8.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 8 > $@
generated/$(STYLE)level9.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 9 > $@
generated/$(STYLE)level10.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 10 > $@
generated/$(STYLE)level11.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 11 > $@
generated/$(STYLE)level12.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 12 > $@
generated/$(STYLE)level13.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 13 > $@
generated/$(STYLE)level14.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 14 > $@
generated/$(STYLE)level15.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 15 > $@
generated/$(STYLE)level16.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 16 > $@
generated/$(STYLE)level17.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 17 > $@
generated/$(STYLE)level18.msinc: generate_style.py
python3 generate_style.py -s $(STYLE) -l 18 > $@
$(mapfile):$(template) $(includes)
$(CPP) -D_debug=$(DEBUG) -D_layerdebug=$(LAYERDEBUG) -DOSM_PREFIX=$(OSM_PREFIX) -DOSM_SRID=$(OSM_SRID) -DOSM_FORCE_POSTGIS_EXTENT=$(OSM_FORCE_POSTGIS_EXTENT) -P -o $(mapfile) $(template) -DTHEME=$(STYLE) -D_proj_lib=\"$(PROJ_LIB)\" -Igenerated
$(CPP) -D_debug=$(DEBUG) -D_proj_lib=\"$(PROJ_LIB)\" -P -o $(configfile) $(tpl_configfile) -Igenerated
$(SED) 's/##.*$$//g' $(mapfile)
$(SED) '/^ *$$/d' $(mapfile)
$(SED) -e 's/OSM_PREFIX_/$(OSM_PREFIX)/g' $(mapfile)
$(SED) -e 's/OSM_SCHEMA/$(OSM_SCHEMA)/g' $(mapfile)
$(SED) -e 's/OSM_SRID/$(OSM_SRID)/g' $(mapfile)
$(SED) -e 's/OSM_UNITS/$(OSM_UNITS)/g' $(mapfile)
$(SED) -e 's/OSM_EXTENT/$(OSM_EXTENT)/g' $(mapfile)
$(SED) -e 's/OSM_WMS_SRS/$(OSM_WMS_SRS)/g' $(mapfile)
$(SED) -e 's/OSM_NAME_COLUMN/$(OSM_NAME_COLUMN)/g' $(mapfile)
$(SED) -e 's/OSM_DB_CONNECTION/$(OSM_DB_CONNECTION)/g' $(mapfile)
boundaries.sql: boundaries.sql.in
cp -f $< $@
$(SED) -e 's/OSM_PREFIX_/$(OSM_PREFIX)/g' $@
clean:
rm -f generated/*
.PHONY: data
data:
cd data; $(MAKE) $(MFLAGS)