From b9f7ca45432916f3cf19ff8b62e428531aa0fa8d Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 12 Feb 2026 08:56:48 +0700 Subject: make: add `build` task The build task set the Version information based on the latest tag and number of commits. --- .gitignore | 3 ++- Makefile | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b0e3e11..41108d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -# SPDX-FileCopyrightText: 2025 M. Shulhan # SPDX-License-Identifier: GPL-3.0-only +# SPDX-FileCopyrightText: 2025 M. Shulhan *.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 +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 . -- cgit v1.3