-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
161 lines (115 loc) · 4.64 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
CC = gcc
CFLAGS = -g -O3 -DTESTING -I ~/perl5/include -L ~/perl5/lib
LANGUAGE = C
LC_ALL = C
LANG = "us_us"
PROGS=bzip-table bzip-table-fosm bzip-table-linecount ragelosm ragelosmt
#seek-bunzip
HEADERS= datafile.hpp tagfile.hpp wayfile.hpp fileindexer.hpp fileindexer.hpp ifileindexer.hpp filepreindexer.hpp
all: $(PROGS) all2
FOSMBin.o : FOSMBin.cpp FOSMBin.hpp
g++ $(CFLAGS) -c $< -o $@
bzip-table : bzip-table.c micro-bunzip.c
g++ $(CFLAGS) bzip-table.c micro-bunzip.c -o $@
bzip-table2 : bzip-table2.c micro-bunzip.c
g++ $(CFLAGS) bzip-table2.c micro-bunzip.c -o $@
bzip-table-fosm : bzip-table-fosm.c micro-bunzip.c
g++ $(CFLAGS) bzip-table-fosm.c micro-bunzip.c -o $@
bzip-table-linecount : bzip-table-linecount.c micro-bunzip.c
g++ $(CFLAGS) bzip-table-linecount.c micro-bunzip.c -o $@
indexer.o : ifileindexer.hpp indexer.c ifileindexer_b.o
g++ $(CFLAGS) -c indexer.c -o $@
preindexer.o : ifileindexer.hpp preindexer.c filepreindexer.hpp
g++ $(CFLAGS) -c preindexer.c -o $@
indexer.c : indexer.rl
ragel -G1 indexer.rl
preindexer.c : preindexer.rl filepreindexer.hpp
ragel -G1 preindexer.rl
ifileindexer.hpp : ifileindexer.tt
tpage $< > $@
ifileindexer_b.cpp : ifileindexer_b.tt $(HEADERS)
tpage $< > $@
%.o : %.c
g++ $(CFLAGS) -c $< -o $@
ifileindexer_b.o : ifileindexer_b.cpp $(HEADERS)
g++ $(CFLAGS) -c $< -o $@
ragelosm : bzip-table-lines2.o process-fosm.o indexer.o ifileindexer_b.o $(HEADERS)
g++ $(CFLAGS) bzip-table-lines2.o process-fosm.o indexer.o ifileindexer_b.o -lbz2 -o $@
bzip-table-lines-threaded.o : bzip-table-lines-threaded.c $(HEADERS)
g++ $(CFLAGS) -c -std=c++0x $< -o $@
ragelosmt : bzip-table-lines-threaded.o process-fosm.o preindexer.o indexer.o ifileindexer_b.o filepreindexer.hpp $(HEADERS)
g++ -static-libgcc -pthread $(CFLAGS) bzip-table-lines-threaded.o process-fosm.o preindexer.o ifileindexer_b.o indexer.o -lbz2 -o $@
seek-bunzip : seek-bunzip.o micro-bunzip.o
micro-bunzip : micro-bunzip.c
$(CC) $(CFLAGS) -DMICRO_BUNZIP_MAIN $< -o $@
test: bzip-table seek-bunzip
# Generate 10 megabytes of random data
dd if=/dev/random of=test_random.dat bs=1024k count=4
# Compress but keep original
bzip2 --force --keep test_random.dat
# Run bzip2recover to build a seperate bz2 file for each block
bzip2recover test_random.dat.bz2
# Build table
./bzip-table < test_random.dat.bz2 > test_random.dat.bz2t
# Grab each block using seek-bunzip and compare to recovered block
nl test_random.dat.bz2t | while read num pos size; \
do \
bzip2 -d -c < rec0000$${num}test_random.dat.bz2 > test_expected; \
./seek-bunzip $${pos} < test_random.dat.bz2 > test_actual; \
cmp test_expected test_actual; \
if [ $$? -ne 0 ]; then \
echo "FAILED: Blocks do not match"; \
exit 1; \
fi; \
done
@echo "SUCCESS!"
clean:
rm -f *.o $(PROGS) test* rec00*
format:
astyle --options=astyle.opts *.c *.h
testfosm: ragelosm
./ragelosm /xapi/planet/earth-20120401130001.osm.bz2
testgeofabrik: ragelosm
./ragelosm ~/OSM-API-Proxy/data/kosovo.osm.bz2 > test.out
testways: ragelosm
./ragelosm testway2.osm.bz2 > test.out
testoffenbach: ragelosm
./ragelosm ~/OSM-API-Proxy/data/offenbach.osm.bz2
vgtestoffenbach: ragelosm
valgrind --log-file=valgrind.txt -v --ignore-ranges=0xbeaa40ec-0xbeadd0cc --leak-check=full --show-reachable=yes --track-origins=yes ./ragelosm ~/OSM-API-Proxy/data/offenbach.osm.bz2
#
viz : indexer.rl
ragel -V indexer.rl > indexer.dot
dotty indexer.dot
#
all2 : componentsreadbin readalldata conncomp waysreadbin hierachy metisexport metisexport2
echo done
#bgl
#
bgl :
g++ -o bgl bgl.cpp -lboost_system -lboost_mpi
strgcomp : strongcomponents.cpp
g++ -g -o strgcomp strongcomponents.cpp -lboost_system -lboost_graph
metisexport2 : metisexport2.cpp FOSMBin.o
g++ -g -o metisexport2 metisexport2.cpp -lboost_system -lboost_graph $(CFLAGS) FOSMBin.o
conncomp : conncomponents.cpp
g++ -g -o conncomp conncomponents.cpp -lboost_system -lboost_graph $(CFLAGS)
componentsreadbin : componentsreadbin.c
gcc -o componentsreadbin componentsreadbin.c
# use this to create a pack file perl process_components.pl
readalldata : readalldata.cpp FOSMBin.hpp FOSMBin.o
g++ $(CFLAGS) -g -o readalldata readalldata.cpp FOSMBin.o
waysreadbin : waysreadbin.c
g++ -o waysreadbin waysreadbin.c
dumplatlon : dumplatlon.cpp FOSMBin.hpp
g++ -o dumplatlon dumplatlon.cpp
hierachy : hierarchybuilder.cpp FOSMBin.hpp FOSMBin.o
g++ -o hierachy hierarchybuilder.cpp FOSMBin.o
testral: readalldata
./readalldata
retest : testoffenbach testral
echo ok
testfosmpart : ragelosm
./ragelosm data/earth-20120401130001.osm.bz2 > debug.txt 2>&1
testthread : ragelosmt
./ragelosmt data/earth-20120401130001.osm.bz2