/
Makefile
54 lines (43 loc) · 1.21 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
CARGO_BIN=~/.cargo/bin/cargo
RUSTUP_BIN=~/.cargo/bin/rustup
OPENSSL_PATH="/usr/local/opt/openssl/"
ZMQ_STATE=.zmq
USE_ZMQ=${ZMQ_CONSUMER}
__PHONY__: all
all: build
config_build_args:
ifneq ($(USE_ZMQ), 1)
$(eval BUILD_ARGS := "--features=tcp")
else
$(eval BUILD_ARGS := "--features=zmq")
endif
$(CARGO_BIN):
curl https://sh.rustup.rs -sSf | sh
build: $(CARGO_BIN) zmq config_build_args
$(CARGO_BIN) build $(BUILD_ARGS)
run: $(CARGO_BIN) build
RUST_LOG=debug $(CARGO_BIN) run $(BUILD_ARGS) -- -c config.yaml
release: $(CARGO_BIN) zmq test
$(CARGO_BIN) build --release $(BUILD_ARGS)
test: $(CARGO_BIN) build
$(CARGO_BIN) test $(BUILD_ARGS)
install: $(CARGO_BIN) test release
ifneq ("$(wildcard /etc/redhat-release)","")
mkdir -p /opt/meowth/
cp target/release/meowth
cp etc/meowth.service /etc/systemd/system/meowth.service
systemctl daemon-reload
else
@echo "Sorry, but simplified installiation is not available for your OS"
endif
zmq:
ifneq ($(USE_ZMQ), 1)
@echo "Not using zMQ. No need to build it."
else ifneq ("$(wildcard $(ZMQ_STATE))","")
@echo "Zmq is already here"
else ifneq ("$(wildcard /etc/redhat-release)","")
yum install zeromq-4.1.2 zeromq-devel-4.1.2
else
sh build_zmq.sh
touch $(ZMQ_STATE)
endif