Merge pull request #373 from cyqsimon/commit-var

Move `COMMIT` into a variable so it could be overridden if desired
This commit is contained in:
Philipp C. Heckel 2022-08-03 13:33:10 -04:00 committed by GitHub
commit 4c566c9f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
MAKEFLAGS := --jobs=1 MAKEFLAGS := --jobs=1
VERSION := $(shell git describe --tag) VERSION := $(shell git describe --tag)
COMMIT := $(shell git rev-parse --short HEAD)
.PHONY: .PHONY:
@ -169,7 +170,7 @@ cli-linux-server: cli-deps-static-sites
-o dist/ntfy_linux_server/ntfy \ -o dist/ntfy_linux_server/ntfy \
-tags sqlite_omit_load_extension,osusergo,netgo \ -tags sqlite_omit_load_extension,osusergo,netgo \
-ldflags \ -ldflags \
"-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" "-linkmode=external -extldflags=-static -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(shell date +%s)"
cli-darwin-server: cli-deps-static-sites cli-darwin-server: cli-deps-static-sites
# This is a target to build the CLI (including the server) manually. # This is a target to build the CLI (including the server) manually.
@ -179,7 +180,7 @@ cli-darwin-server: cli-deps-static-sites
-o dist/ntfy_darwin_server/ntfy \ -o dist/ntfy_darwin_server/ntfy \
-tags sqlite_omit_load_extension,osusergo,netgo \ -tags sqlite_omit_load_extension,osusergo,netgo \
-ldflags \ -ldflags \
"-linkmode=external -s -w -X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" "-linkmode=external -s -w -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(shell date +%s)"
cli-client: cli-deps-static-sites cli-client: cli-deps-static-sites
# This is a target to build the CLI (excluding the server) manually. This should work on Linux/macOS/Windows. # This is a target to build the CLI (excluding the server) manually. This should work on Linux/macOS/Windows.
@ -189,7 +190,7 @@ cli-client: cli-deps-static-sites
-o dist/ntfy_client/ntfy \ -o dist/ntfy_client/ntfy \
-tags noserver \ -tags noserver \
-ldflags \ -ldflags \
"-X main.version=$(VERSION) -X main.commit=$(shell git rev-parse --short HEAD) -X main.date=$(shell date +%s)" "-X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(shell date +%s)"
cli-deps: cli-deps-static-sites cli-deps-all cli-deps-gcc cli-deps: cli-deps-static-sites cli-deps-all cli-deps-gcc