-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
34 lines (27 loc) · 1.24 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
plugin_dirs := $(wildcard plugin/*/)
plugin_obs := $(foreach plugin,$(plugin_dirs),$(plugin)plugin.so)
plugin_src := $(patsubst %plugin.so,%*.go,$(plugin_obs))
quicklearn_bin := resources/quickrank/bin/quicklearn
go_source = *.go cmd/searchrefiner/*.go
SERVER = server
plugin: $(plugin_obs)
PHONEY: run all plugin clean quicklearn
# These compile the quicklearn binary, which are required for the QueryLens plugin.
$(quicklearn_bin):
@git clone --recursive https://github.com/hpclab/quickrank.git
@cd quickrank && mkdir build_ && cd build_ && cmake .. -DCMAKE_CXX_COMPILER=g++-5 -DCMAKE_BUILD_TYPE=Release && make
@mv quickrank resources/quickrank
quicklearn: $(quicklearn_bin)
# The main server compilation step. It depends on the compilation of any plugins that exist.
$(SERVER): $(plugin_obs) $(go_source)
go build -o server cmd/searchrefiner/server.go
# The plugins are just shared object files that should only need to be recompiled if changed.
.SECONDEXPANSION:
$(plugin_obs): $$(patsubst %plugin.so,%*.go,$$@)
go build -buildmode=plugin -o $@ $^
# Running the server may optionally depend on quicklearn.
run: quicklearn $(SERVER)
@mkdir -p plugin_storage
@./server
clean:
@[ -f server ] && rm $(foreach plugin,$(plugin_obs),$(plugin)) server || true