mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
feat: add version command (#26)
This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
GO := go
|
||||
BIN_DIR := bin
|
||||
BIN := $(BIN_DIR)/pmg
|
||||
SHELL := /bin/bash
|
||||
GITCOMMIT := $(shell git rev-parse HEAD)
|
||||
VERSION := "$(shell git describe --tags --abbrev=0)-$(shell git rev-parse --short HEAD)"
|
||||
|
||||
GO_CFLAGS=-X 'github.com/safedep/pmg/cmd/version.commit=$(GITCOMMIT)' -X 'github.com/safedep/pmg/cmd/version.version=$(VERSION)'
|
||||
GO_LDFLAGS=-ldflags "-w $(GO_CFLAGS)"
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: pmg
|
||||
|
||||
pmg: create_bin
|
||||
$(GO) build -o $(BIN) main.go
|
||||
$(GO) build ${GO_LDFLAGS} -o $(BIN) main.go
|
||||
|
||||
create_bin:
|
||||
mkdir -p $(BIN_DIR)
|
||||
|
||||
Reference in New Issue
Block a user