spruce/Makefile
Dan Anglin 52868d7aa8
fix: add version and print with --version
Add a version variable that is printed to screen with the --version
flag.

Add a basic Makefile for building and installing spruce.
2023-03-08 00:42:04 +00:00

21 lines
424 B
Makefile

BINARY = spruce
INSTALL_PREFIX ?= /usr/local
CGO_ENABLED ?= 0
GOOS ?= linux
GOARCH ?= amd64
VERSION = 0.1.0
LDFLAGS = "-s -w -X main.version=$(VERSION) -X main.installPrefix=$(INSTALL_PREFIX)"
$(BINARY):
go build -ldflags=$(LDFLAGS) -v -a -o $(BINARY)
install: spruce
cp -f $(BINARY) $(INSTALL_PREFIX)/bin
chmod 0755 $(INSTALL_PREFIX)/bin/$(BINARY)
uninstall:
rm -f $(INSTALL_PREFIX)/bin/$(BINARY)
clean:
go clean