aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-02-12 08:56:48 +0700
committerShulhan <ms@kilabit.info>2026-02-12 08:56:48 +0700
commitb9f7ca45432916f3cf19ff8b62e428531aa0fa8d (patch)
treedb3f15c1a234cb06c9d1fde21b04892240956237
parente4b3383d84cd181f4a9fec1097ec61e583d6f827 (diff)
downloadjarink-b9f7ca45432916f3cf19ff8b62e428531aa0fa8d.tar.xz
make: add `build` task
The build task set the Version information based on the latest tag and number of commits.
-rw-r--r--.gitignore3
-rw-r--r--Makefile7
2 files changed, 9 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index b0e3e11..41108d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-# SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
# SPDX-License-Identifier: GPL-3.0-only
+# SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
*.html
/cover.out
+/jarink
diff --git a/Makefile b/Makefile
index ee4eb7e..e8b66c0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
## SPDX-License-Identifier: GPL-3.0-only
## SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+VERSION=$(shell git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
+
COVER_OUT:=cover.out
COVER_HTML:=cover.html
@@ -18,6 +20,11 @@ test:
-coverprofile=$(COVER_OUT) ./...
go tool cover -html=$(COVER_OUT) -o $(COVER_HTML)
+.PHONY: build
+build: LDFLAGS=-X 'git.sr.ht/~shulhan/jarink.Version=$(VERSION)'
+build:
+ go build -ldflags="$(LDFLAGS)" ./cmd/jarink
+
.PHONY: doc.serve
doc.serve:
ciigo serve .