-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
195 lines (179 loc) · 8.61 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#Compiles the default olaf version for use on traditional computers
compile:
gcc -c src/pffft.c -W -Wall -std=gnu11 -pedantic -O2 #pfft needs M_PI and other constants not in the ANSI c standard
gcc -c src/midl.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/mdb.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/hash-table.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/queue.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_deque.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_max_filter_perceptual_van_herk.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_file_writer.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_db.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer_cache.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_ep_extractor.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_extractor.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_reader_stream.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_runner.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_stream_processor.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_matcher.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_config.c -W -Wall -std=c11 -pedantic -O2
mkdir -p bin
gcc -o bin/olaf_c *.o -lc -lm -ffast-math -pthread
lib:
gcc -c src/pffft.c -W -Wall -fPIC -std=gnu11 -pedantic -O2 #pfft needs M_PI and other constants not in the ANSI c standard
gcc -c src/midl.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/mdb.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/hash-table.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/queue.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_deque.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_max_filter_perceptual_van_herk.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fp_file_writer.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_db.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer_cache.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_ep_extractor.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fp_extractor.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_reader_stream.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_runner.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_stream_processor.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fp_matcher.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_config.c -W -Wall -fPIC -std=c11 -pedantic -O2
gcc -c src/olaf_fft.c -W -Wall -fPIC -std=c11 -pedantic -O2
mkdir -p bin
gcc -o bin/libolaf.so *.o -lc -lm -fPIC -ffast-math -pthread -shared
#A compilation with support for profiling
compile_gprof:
gcc -c src/pffft.c -pg -W -Wall -std=gnu11 -pedantic -O2 #pfft needs M_PI and other constants not in the ANSI c standard
gcc -c src/midl.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/mdb.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/hash-table.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/queue.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_deque.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_max_filter_perceptual_van_herk.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_file_writer.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_db.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer_cache.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_ep_extractor.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_extractor.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_reader_stream.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_runner.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_stream_processor.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_matcher.c -pg -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_config.c -pg -W -Wall -std=c11 -pedantic -O2
mkdir -p bin
gcc -o bin/olaf_c *.o -pg -lc -lm -ffast-math -pthread
#The memory database version is equal to the embedded version
#pass the -D to load the correct
mem:
gcc -c src/pffft.c -Dmem -W -Wall -std=gnu11 -pedantic -O2 #pfft needs M_PI and other constants not in the ANSI c standard
gcc -c src/hash-table.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/queue.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_deque.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_max_filter_perceptual_van_herk.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf.c -Dmem -W -Wall -std=gnu11 -pedantic -O2
gcc -c src/olaf_db_mem.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer_mem.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_file_writer.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_db_writer_cache.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_runner.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_stream_processor.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_ep_extractor.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_extractor.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_reader_stream.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_fp_matcher.c -Dmem -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_config.c -Dmem -W -Wall -std=c11 -pedantic -O2
mkdir -p bin
gcc -o bin/olaf_mem *.o -lc -lm -ffast-math
# -s MODULARIZE=1 \
# -s WASM=1 \
# -s BINARYEN_ASYNC_COMPILATION=0 \
#Compiles the webassembly version: it is similar to the mem version
web:
emcc -o wasm/js/olaf.js \
-s ASSERTIONS=1 \
-s ENVIRONMENT=shell \
-s MODULARIZE=1 \
-s SINGLE_FILE=1 \
--bind \
-s ALLOW_MEMORY_GROWTH=1 \
-s EXPORTED_FUNCTIONS="['_malloc','_free']" \
-s EXPORTED_RUNTIME_METHODS='["cwrap"]' \
src/olaf_wasm.c \
src/pffft.c \
src/hash-table.c \
src/queue.c \
src/olaf_deque.c \
src/olaf_max_filter_perceptual_van_herk.c \
src/olaf_ep_extractor.c \
src/olaf_fp_extractor.c \
src/olaf_db_mem.c \
src/olaf_fp_db_writer_mem.c \
src/olaf_fp_matcher.c \
src/olaf_config.c -O3 -Wall -lm -lc -W -I. -ffast-math
echo "//Hack to force resampler to create functions" > wasm/js/olaf_processor.js
echo "let exports = [];" >> wasm/js/olaf_processor.js
cat wasm/js/olaf.js wasm/js/olaf_processor_edit.js >> wasm/js/olaf_processor.js
rm wasm/js/olaf.js
#Cleans the temporary files
clean:
-rm -f *.o
-rm -f bin/*
-rm -f wasm/js/olaf.js
-rm -f wasm/js/olaf.html
-rm -f wasm/js/olaf.wasm
-rm -f olaf_cffi*
#Deletes the database, check your configuration for the database location
destroy_db:
rm ~/.olaf/db/*
#Installs olaf on its default location
install:
mkdir -p ~/.olaf/db/
sudo mv bin/olaf_c /usr/local/bin/olaf_c
sudo chmod +x /usr/local/bin/olaf_c
sudo cp olaf.rb /usr/local/bin/olaf
sudo chmod +x /usr/local/bin/olaf
#Only install the Ruby part, mainly for dev purposes
install_r:
sudo cp olaf.rb /usr/local/bin/olaf
sudo chmod +x /usr/local/bin/olaf
#installs olaf as root user
install-su:
mkdir -p ~/.olaf/db/
cp bin/olaf_c /usr/local/bin/olaf_c
chmod +x /usr/local/bin/olaf_c
cp olaf.rb /usr/local/bin/olaf
chmod +x /usr/local/bin/olaf
#removes all installed files
uninstall:
rm -r ~/.olaf
sudo rm /usr/local/bin/olaf /usr/local/bin/olaf_c
#Compile unit tests and run the unit tests
#The functional tests are run via ruby, see readme
test:
gcc -c src/olaf_config.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_reader_stream.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/queue.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_deque.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_max_filter_naive.c -W -Wall -std=c11 -pedantic -O2
gcc -c tests/olaf_tests.c -Isrc -W -Wall -std=c11 -pedantic -O2
gcc -c src/midl.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/mdb.c -W -Wall -std=c11 -pedantic -O2
gcc -c src/olaf_db.c -W -Wall -std=c11 -pedantic -O2
mkdir -p bin
gcc -o bin/olaf_tests *.o -lc -lm -ffast-math
mkdir -p tests/olaf_test_db
- rm tests/olaf_test_db/*
#Generate doxygen API documentation
docs:
doxygen
#Compile a windows exe using Zig
zig_win:
zig build -Dtarget=x86_64-windows-gnu
#Compile a webassembly version, currently unused, via Zig
zig_web:
zig build -Dtarget=wasm32-freestanding-musl -Drelease-small