aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 14 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 4b4f88f..a17d4e4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,20 @@
## SPDX-FileCopyrightText: 2021 M. Shulhan <ms@kilabit.info>
## SPDX-License-Identifier: GPL-3.0-or-later
-.PHONY: all install
-all:
+.PHONY: all test build install
+
+VERSION:=$(shell git describe --tags)
+LDFLAGS:=-ldflags "-s -w -X 'git.sr.ht/~shulhan/gotp.Version=$(VERSION)'"
+
+all: test build
+
+test:
CGO_ENABLED=1 go test -race -failfast -coverprofile=cover.out ./...
go tool cover -html=cover.out -o cover.out
-install:
- go install ./cmd/gotp
+build:
+ mkdir -p _bin/
+ go build $(LDFLAGS) -o _bin/ ./cmd/...
+
+install: build
+ install -m755 _bin/gotp $(GOBIN)/