awl/Makefile
Sam Therapy e482663af7
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
(man) fix manpath
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-07-24 20:08:36 +02:00

59 lines
No EOL
1 KiB
Makefile

# SPDX-License-Identifier: BSD-3-Clause
HASH := $(shell git describe --always --dirty || echo "UNKNOWN")
VER := "git-$(HASH)"
CGO_ENABLED = 0
GO := go
GOFLAGS := -ldflags "-s -w -X 'main.version=$(VER)'"
SCDOC := scdoc
PREFIX := /usr/local
BINPATH := $(PREFIX)/bin
MANPATH := /usr/share/man
PROG := awl
ifeq ($(OS),Windows_NT)
EXE := $(PROG).exe
else
EXE := $(PROG)
endif
.PHONY: clean lint
# hehe
all: $(PROG)
$(PROG): lint
$(GO) build -o $(EXE) $(GOFLAGS) .
doc: doc/awl.1.md
$(SCDOC) < doc/$(PROG).1.md > doc/$(PROG).1
test: coverage/coverage.out
$(GO) test -v -cover -coverprofile=coverage/coverage.out ./...
cover: test
$(GO) tool cover -func=coverage/coverage.out
$(GO) tool cover -html=coverage/coverage.out -o coverage/cover.html
fmt: *.go
gofmt -w -s .
vet: *.go
$(GO) vet ./...
lint: fmt vet
-golangci-lint run
install:
$(GO) install $(GOFLAGS) .
install_doc: doc
install doc/$(PROG).1 $(MANPATH)/man1
@echo ""
@echo "Make sure to update your manual database"
@echo "'sudo mandb' on Debian/Ubuntu"
clean:
$(GO) clean