-
-
Notifications
You must be signed in to change notification settings - Fork 91
/
Makefile
42 lines (33 loc) · 937 Bytes
/
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
.PHONY: build test install
SRC_PATH=cmd/arc/*.go
TARGET=arc
PREFIX_DIR=/usr/local
BIN_DIR=$(PREFIX_DIR)/bin
CONFIG_DIR=$(PREFIX_DIR)/etc
SERVICE_DIR=/lib/systemd/system
SERVICE_LN_DIR=/etc/systemd/system
all: build
build:
@mkdir -p build
@go build $(FLAGS) -o build/$(TARGET) $(SRC_PATH)
assets: bindata
@rm -rf webui/compiled.go
@go-bindata -o webui/compiled.go -pkg webui webui/...
bindata:
@go install github.com/jteeuwen/go-bindata
test:
@go test ./...
run_dev: build
./build/$(TARGET) -config dev_config.toml
clean:
@rm -rf build
install:
@service arc stop
@cp build/$(TARGET) /usr/local/bin/
@setcap 'cap_net_bind_service=+ep' /usr/local/bin/$(TARGET)
@mkdir -p /usr/local/etc/$(TARGET)
@test -s /usr/local/etc/$(TARGET)/config.json || { cp sample_config.json /usr/local/etc/$(TARGET)/config.json; }
@cp arc.service /etc/systemd/system/
@systemctl daemon-reload
@systemctl enable arc
@service arc restart