source: subversion/applications/rendering/gosmore/Makefile.in @ 22745

Last change on this file since 22745 was 22102, checked in by nic, 9 years ago

Fix compilation error on 64 bit.
Fix libgps support for gpsd-2.90

File size: 7.7 KB
Line 
1# Written by Nic Roets with contributions by Petter Reinholdtsen
2# Placed in the public domain
3
4TODAY := `exec date +%Y%m%d`
5VERSION = 0.0.0.$(TODAY)
6
7DESTDIR=
8prefix = @prefix@
9bindir = $(prefix)/bin
10datarootdir = $(prefix)/share
11
12CFLAGS=-O2 -DRES_DIR=\"$(prefix)/share/gosmore/\"
13WARNFLAGS= -W -Wall
14
15#"------------------------ Compiling with cegcc : ---------------------------
16# tar xzf -C / cygwin-cegcc-mingw32ce-0.51.0-1.tar.gz
17# export PATH="$PATH":/opt/mingw32ce/bin/
18
19WINDRES=        ${ARCH}windres
20
21# enable this to test the experimental route support
22#CFLAGS += -DROUTE_TEST
23
24# enable this to force gosmore into headless mode (gosmore will also
25# be put in headless mode if gtk+-2.0 isn't available)
26#CFLAGS += -DHEADLESS
27
28ifneq (${OS},Windows_NT)
29EXTRA=`pkg-config --cflags --libs gtk+-2.0 || echo -D HEADLESS` \
30  `pkg-config --libs libcurl` \
31  `[ -e /usr/include/gps.h ] && echo -DUSE_GPSD -lgps `\
32  `pkg-config --libs pkg-config --libs gthread-2.0`
33
34# I found that it's more reliable and more portable to use aplay, but
35# gnome sound can still be activated with this:
36#  `pkg-config --cflags --libs libgnomeui-2.0 && echo -DUSE_GNOMESOUND`
37XMLFLAGS=`pkg-config --cflags libxml-2.0 || echo -I /usr/include/libxml2` \
38  `pkg-config --libs libxml-2.0 || echo -l xml2 -lm`
39ARCH=arm-mingw32ce-
40else
41# To compile with mingw, install MSYS and mingw, and then download
42# the "all-in-one bundle" from http://www.gtk.org/download-windows.html
43# and unzip it to C:\msys\1.0.
44EXTRAC=-mms-bitfields -mno-cygwin -mwindows \
45  `pkg-config --cflags gtk+-2.0 || echo -D NOGTK`
46EXTRAL=`pkg-config --libs gtk+-2.0`
47EXE=.exe
48W32LIBS=-lwsock32 -lwinmm
49endif
50
51all: gosmore$(EXE)
52
53# The planet is too big to fit into the address space of a single process on
54# a 32 bit CPUs. So we break it up into pieces (overlapping rectangles and
55# some lowzoom extracts) and then run one process for each piece. The parent
56# task then chooses the most
57# appropriate process and forwards the expose, search or routing request to
58# it. THE CODE IS NOT FINISHED. Linux version looks promising.
59gosmore:        gosmore.cpp libgosm.cpp libgosm.h bboxes.c
60                g++ -DCHILDREN=16 ${CFLAGS} ${WARNFLAGS} ${XMLFLAGS} \
61                  gosmore.cpp libgosm.cpp -o gosmore ${EXTRA}
62
63gosmore16:      gosmore.cpp libgosm.cpp libgosm.h
64                g++ -DGOSMZ=16 ${CFLAGS} ${WARNFLAGS} ${XMLFLAGS} \
65                  gosmore.cpp libgosm.cpp -o gosmore16 ${EXTRA}
66
67$(ARCH)gosmore.exe:     gosmore.cpp libgosm.cpp gosmore.rsc resource.h \
68                    libgosm.h ceglue.h ceglue.c bboxes.c
69                ${ARCH}g++ ${CFLAGS} ${EXTRAC} -c gosmore.cpp
70                ${ARCH}g++ ${CFLAGS} ${EXTRAC} -c libgosm.cpp
71                ${ARCH}gcc ${CFLAGS} ${EXTRAC} -c ConvertUTF.c
72                ${ARCH}gcc ${CFLAGS} ${EXTRAC} -c ceglue.c
73                ${ARCH}g++ -static ${CFLAGS} ${EXTRAC} -o $@ \
74                  gosmore.o libgosm.o ceglue.o ConvertUTF.o gosmore.rsc $(W32LIBS)
75
76tagcmp.o:       tagcmp.l
77
78gosmore.rsc:    gosmore.rc icons.bmp icons-mask.bmp gosmore.ico
79                $(WINDRES) $< $@
80
81WIKIPAGE=http://wiki.openstreetmap.org/index.php/Special:Export/Gosmore
82translations.c: extract
83                wget -O - ${WIKIPAGE}/Translations |./extract >translations.c
84
85extract:        extract.c
86                ${CC} ${CFLAGS} ${XMLFLAGS} extract.c -o extract
87
88bboxes.c:       density.c density.txt
89                gcc -lm density.c -o density
90                ./density <density.txt >density.sh
91# wget http://www.openstreetmap.org/api/0.6/changeset/1707270/download -O \
92#   countries.osm
93
94osmunda:        osmunda.cpp libgosm.cpp libgosm.h
95                g++ ${CFLAGS} ${WARNFLAGS} ${XMLFLAGS} \
96                  osmunda.cpp libgosm.cpp -o osmunda
97voices:
98                echo '(voice_rab_diphone)' >/tmp/voice_rab_diphone
99                echo 'At the junction, turn left.' | festival_client \
100                  --prolog /tmp/voice_rab_diphone --output turnleft.wav --ttw
101                echo 'At the junction, turn right.' | festival_client \
102                  --prolog /tmp/voice_rab_diphone --output turnright.wav --ttw
103                echo 'Keep left.' | festival_client \
104                  --prolog /tmp/voice_rab_diphone --output keepleft.wav --ttw
105                echo 'Keep right.' | festival_client \
106                  --prolog /tmp/voice_rab_diphone --output keepright.wav --ttw
107                echo 'If possible make a U turn.' | festival_client \
108                  --prolog /tmp/voice_rab_diphone --output uturn.wav --ttw
109                echo 'You have reached your destination.' | festival_client \
110                  --prolog /tmp/voice_rab_diphone --output stop.wav --ttw
111                echo 'At the roundabout take the first exit.' | \
112  festival_client --prolog /tmp/voice_rab_diphone --output round1.wav --ttw
113                echo 'At the roundabout take the second exit.' | \
114  festival_client --prolog /tmp/voice_rab_diphone --output round2.wav --ttw
115                echo 'At the roundabout take the third exit.' | \
116  festival_client --prolog /tmp/voice_rab_diphone --output round3.wav --ttw
117                echo 'At the roundabout take the fourth exit.' | \
118  festival_client --prolog /tmp/voice_rab_diphone --output round4.wav --ttw
119                echo 'At the roundabout take the fifth exit.' | \
120  festival_client --prolog /tmp/voice_rab_diphone --output round5.wav --ttw
121                echo 'At the roundabout take the sixth exit.' | \
122  festival_client --prolog /tmp/voice_rab_diphone --output round6.wav --ttw
123                echo 'At the roundabout take the seventh exit.' | \
124  festival_client --prolog /tmp/voice_rab_diphone --output round7.wav --ttw
125                echo 'At the roundabout take the eight exit.' | \
126  festival_client --prolog /tmp/voice_rab_diphone --output round8.wav --ttw
127
128#elemstyles.xml:
129#               wget http://josm.openstreetmap.de/svn/trunk/styles/standard/elemstyles.xml
130
131zip:
132        (cd /msys; zip - etc/gtk-2.0/* lib/gtk-2.0/2.10.0/loaders/*) >gosmore.zip
133        zip -j gosmore.zip gosmore.exe icons.xpm /msys/bin/libcairo-2.dll \
134        /msys/bin/lib*.dll /msys/bin/intl*.dll /msys/bin/zlib*.dll
135        zip -j gosm_arm.zip ARMV4Rel/gosm_arm.exe *.wav
136        # scp -P 100 gosm_arm.zip gosmore.zip \
137        #  nroets@nroets.openhost.dk:nroets.openhost.dk/htdocs/
138
139install: gosmore default.pak
140        mkdir -p $(DESTDIR)$(bindir)
141        cp gosmore $(DESTDIR)$(bindir)/.
142        mkdir -p $(DESTDIR)$(datarootdir)/gosmore
143        cp -a *.wav default.pak elemstyles.xml icons.csv icons.xpm \
144          $(DESTDIR)$(datarootdir)/gosmore
145        mkdir -p $(DESTDIR)$(datarootdir)/man/man1
146        gzip <gosmore.1 >$(DESTDIR)$(datarootdir)/man/man1/gosmore.1.gz
147        mkdir -p $(DESTDIR)$(datarootdir)/pixmaps
148        cp -a gosmore.xpm $(DESTDIR)$(datarootdir)/pixmaps
149        mkdir -p $(DESTDIR)$(datarootdir)/applications
150        cp -a gosmore.desktop $(DESTDIR)$(datarootdir)/applications
151
152# The commands below will create a gpx file with a low res version of the national boundaries
153# Then you must open tmp.gpx in JOSM and save it as bounds.osm. Then this makefile will
154# use sed to reencode the ids to the 2 billion range and use grep to concatenate it with
155# the geonames cities and the osm country names.
156#
157# sudo apt-get install libshp-dev
158# wget http://www.obviously.com/gis/shp2text/shp2text.c
159# gcc -lshp shp2text.c -o shp2text
160# wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m-admin-0-countries.zip
161# unzip 110m-admin-0-countries.zip
162# ./shp2text --gpx 110m-admin-0-countries.shp 0 4 |
163#   gpsbabel -r -i gpx -f - -x transform,trk=rte,del -o gpx -F tmp.gpx
164 
165default.pak: gosmore
166        ! [ -e gosmore.pak ]
167        (bzgrep -v '</osm>' bounds.osm.bz2 | sed -e 's/'\''-\([0-9]*'\''\)/'\''00000000\1/' |\
168          sed -e 's/0*\([0-9]\{8\}'\''\)/21\1/'; \
169         bzcat lowres.osm.bz2; \
170         egrep -v '?xml|<osmCha' countries.osm | sed -e 's|/osmChange|/osm|') | \
171             QUERY_STRING=suppressGTK ./gosmore rebuild
172        mv gosmore.pak default.pak
173
174routingTest: gosmore
175        ! [ -e gosmore.pak ]
176        sed -e 's/\(nd='\''\|ref='\''\|id='\''\)-\([0-9]*'\''\)/\121000\2/' routingTest.osm |\
177          ./gosmore rebuild
178
179dist:
180        mkdir gosmore-$(VERSION)
181        cp gosmore.cpp Makefile elemstyles.xml icons.csv icons.xpm  README \
182          gosmore-$(VERSION)
183        tar zcf gosmore-$(VERSION).tar.gz gosmore-$(VERSION)
184        rm -rf gosmore-$(VERSION)
185
186clean:
187        $(RM) gosmore *.tmp *~ gosmore.zip $(ARCH)gosmore.exe gosmore.rsc \
188          gosmore.aps gosmore.vcl gosmore.vcw extract *.o
Note: See TracBrowser for help on using the repository browser.