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}") .PHONY: build build: bin/server 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 .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: gofmt -d -e cmd/ pkg/ .PHONY: check_linting check_linting: @echo "Not implemented!" .PHONY: unit_test unit_test: @echo "Not implemented!"