30 lines
750 B
Makefile
30 lines
750 B
Makefile
|
SOURCES := $(shell find ./ -type f -name '*.go')
|
||
|
BUILD_DIR := build
|
||
|
TARGET := $(BUILD_DIR)/sensenet
|
||
|
INSTALL_DIR := /usr/local/bin
|
||
|
|
||
|
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)
|
||
|
|
||
|
/etc/sensenet:
|
||
|
sudo mkdir -p /etc/sensenet
|
||
|
|
||
|
/etc/systemd/system/sensenet.service: ops/sensenet.service
|
||
|
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
|