2022-02-27 10:10:21 +00:00
|
|
|
SOURCES := $(shell find ./ -type f -name '*.go')
|
2022-02-27 06:57:13 +00:00
|
|
|
BUILD_DIR := build
|
2022-02-27 10:10:21 +00:00
|
|
|
TARGET := $(BUILD_DIR)/sensenet
|
|
|
|
CONF_DIR := /etc/sensenet
|
|
|
|
INSTALL_DIR := /usr/local/bin
|
|
|
|
SERVICE_FILE := /etc/systemd/system/sensenet.service
|
2022-02-27 06:57:13 +00:00
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
mkdir -p $(BUILD_DIR)
|
|
|
|
|
|
|
|
$(TARGET): $(BUILD_DIR) $(SOURCES)
|
|
|
|
go build -o $@ ./cmd/sensenet
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: $(TARGET) /etc/sensenet /etc/systemd/system/sensenet.service
|
|
|
|
sudo install $(TARGET) $(INSTALL_DIR)
|
|
|
|
|
2022-02-27 10:10:21 +00:00
|
|
|
.PHONY: confdir
|
|
|
|
confdir: $(CONF_DIR)
|
2022-02-27 06:57:13 +00:00
|
|
|
|
2022-02-27 10:10:21 +00:00
|
|
|
$(CONF_DIR):
|
|
|
|
sudo mkdir -p $@
|
|
|
|
|
|
|
|
.PHONY: servicefile
|
|
|
|
servicefile: $(SERVICE_FILE))
|
|
|
|
|
|
|
|
$(SERVICE_FILE): ops/sensenet.service
|
2022-02-27 06:57:13 +00:00
|
|
|
install ops/sensenet.service /etc/systemd/system/sensenet.service
|
|
|
|
systemctl daemon-reload
|
|
|
|
|
|
|
|
.PHONY: service
|
|
|
|
service: /etc/systemd/system/sensenet.service
|
|
|
|
systemctl enable sensenet.service
|
|
|
|
systemctl restart sensenet.service
|
|
|
|
systemctl status sensenet.service
|
2022-02-27 10:26:35 +00:00
|
|
|
|
|
|
|
.PHONY: deps
|
|
|
|
deps:
|
2022-02-27 10:28:59 +00:00
|
|
|
sudo apt-get -y install protobuf-compiler libczmq-dev
|