netoik-api/Makefile

60 lines
1.3 KiB
Makefile
Raw Normal View History

2023-01-24 17:40:54 +00:00
NAME = netoik-api
VERSION = $(shell [ -d ".git" ] && git describe | sed "s/-/./g")
SYSCONFDIR = $(shell rpm --eval "%{_sysconfdir}")
UNITDIR = $(shell rpm --eval "%{_unitdir}")
BINDIR = $(shell rpm --eval "%{_bindir}")
VARDIR = $(shell rpm --eval "%{_var}")
2023-01-19 15:49:23 +00:00
2023-01-24 17:40:54 +00:00
.PHONY: build
2023-01-19 15:49:23 +00:00
build: bin/server
2023-01-24 17:40:54 +00:00
bin/server: cmd/server/main.go pkg/*/*.go go.mod go.sum
mkdir --parents bin
CGO_ENABLED=0 go build -o "$@" ./cmd/server/main.go
.PHONY: version
version:
@echo $(VERSION)
.PHONY: tarball
tarball: $(HOME)/rpmbuild/SOURCES/$(NAME)-$(VERSION).tar.gz
$(HOME)/rpmbuild/SOURCES/$(NAME)-%.tar.gz: .
git archive --format=tar.gz \
--output=$@ \
--prefix=$(NAME)-$(VERSION)/ \
--worktree-attributes \
--verbose \
HEAD
2023-01-24 17:40:54 +00:00
.PHONY: install
install:
install -D \
--no-target-directory \
server.conf.sample \
"$(DESTDIR)$(SYSCONFDIR)/$(NAME)/server.conf"
install -D \
--target-directory="$(DESTDIR)$(SYSCONFDIR)/$(NAME)" \
server.conf.sample
install -D \
--target-directory="$(DESTDIR)$(UNITDIR)" \
systemd/netoik-api-server.service
install -D \
--no-target-directory \
bin/server \
"$(DESTDIR)$(BINDIR)/$(NAME)-server"
install --directory "$(DESTDIR)$(VARDIR)/$(NAME)/captcha"
.PHONY: check_format
check_format:
2023-05-11 12:56:32 +00:00
gofmt -d -e cmd/ pkg/
.PHONY: check_linting
check_linting:
@echo "Not implemented!"
.PHONY: unit_test
unit_test:
@echo "Not implemented!"