From b322484e489589c8e2b58f738a7317cdcf12a90c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 16 Nov 2024 00:08:57 -0600 Subject: [PATCH] fix build --- Makefile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 96a6537..56d2f26 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,26 @@ +.PHONY: build + VERSION = $(shell git describe --tags) +BUILDTIME = $(shell date +%Y.%m.%d) -# create the go.mod and go.sum if this is a brand new repo -# REDOMOD = $(shell if [ -e go.mod ]; then echo go.mod; else echo no go mod; fi) -REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE= go mod init; GO111MODULE= go mod tidy; fi) - -all: - GO111MODULE=off go build -v -x -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}" +all: build ./virtigod --version - # sudo ./virtigod -# this is for release builds using the go.mod files -release-build: - @echo ${REDOMOD} - go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}" +build: + GO111MODULE=off go build \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + +verbose: + GO111MODULE=off go build -v -x \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + +install: + GO111MODULE=off go install \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" # makes a .deb package debian: - rm -f ~/incoming/virtigod*deb - go-deb --no-gui --repo go.wit.com/lib/daemons/virtigod + go-deb --auto --repo go.wit.com/lib/daemons/virtigod goimports: goimports -w *.go