Skip to content

Commit

Permalink
Small but important fixes to Makefile. (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcopaganini authored Oct 16, 2021
1 parent aa07d3c commit 2e1d128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ bin := bitrot
bindir := /usr/local/bin
archdir := arch
src := $(wildcard *.go)
git_tag := $(shell git describe --tags)
git_tag := $(shell git describe --always --tags)

# Default target
${bin}: Makefile ${src}
go build -v -ldflags "-X main.Build=${git_tag}" -o "${bin}"
go build -v -ldflags "-X main.BuildVersion=${git_tag}" -o "${bin}"

clean:
rm -f "${bin}"
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/marcopaganini/logger"
)

// This is filled by go build -ldflags during build.
var Build string
// BuildVersion is filled by go build -ldflags during build.
var BuildVersion string

const (
stateDirPrefix = ".bitrot"
Expand Down Expand Up @@ -79,7 +79,7 @@ func parseFlags() error {
flag.Parse()

if Opt.version {
fmt.Printf("bitrot build: %s\n", Build)
fmt.Printf("bitrot build: %s\n", BuildVersion)
os.Exit(0)
}

Expand Down

0 comments on commit 2e1d128

Please sign in to comment.