SOURCES := $(shell find ./ -type f -name '*.go') BUILD_DIR := build TARGET := $(BUILD_DIR)/sensenet CONF_DIR := /etc/sensenet INSTALL_DIR := /usr/local/bin SERVICE_FILE := /etc/systemd/system/sensenet.service 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) .PHONY: confdir confdir: $(CONF_DIR) $(CONF_DIR): sudo mkdir -p $@ .PHONY: servicefile servicefile: $(SERVICE_FILE)) $(SERVICE_FILE): 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