2020-11-24 01:38:18 +00:00
|
|
|
# Basic Go makefile
|
|
|
|
|
|
|
|
GOCMD=go
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
GOTEST=$(GOCMD) test
|
|
|
|
GOGET=$(GOCMD) get
|
|
|
|
|
|
|
|
DIRS=`go list ./...`
|
|
|
|
|
2023-12-12 20:07:28 +00:00
|
|
|
PYTHON=python3
|
|
|
|
PIP=$(PYTHON) -m pip
|
|
|
|
|
2020-11-24 01:38:18 +00:00
|
|
|
all: build
|
|
|
|
|
|
|
|
build:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
$(GOBUILD) -v $(DIRS)
|
|
|
|
|
|
|
|
test:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
$(GOTEST) -v $(DIRS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
$(GOCLEAN) ./...
|
|
|
|
|
|
|
|
fmts:
|
|
|
|
gofmt -s -w .
|
|
|
|
|
|
|
|
vet:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
$(GOCMD) vet $(DIRS) | grep -v unkeyed
|
|
|
|
|
|
|
|
tidy: export GO111MODULE = on
|
|
|
|
tidy:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
mod-update: export GO111MODULE = on
|
|
|
|
mod-update:
|
|
|
|
@echo "GO111MODULE = $(value GO111MODULE)"
|
|
|
|
go get -u ./...
|
|
|
|
go mod tidy
|
|
|
|
|
2023-12-12 20:07:28 +00:00
|
|
|
prereq:
|
|
|
|
@echo "Installing python prerequisites -- ignore err if already installed:"
|
|
|
|
- $(PIP) install -r requirements.txt
|
|
|
|
@echo
|
|
|
|
@echo "if this fails, you may see errors like this:"
|
|
|
|
@echo " Undefined symbols for architecture x86_64:"
|
|
|
|
@echo " _PyInit__gi, referenced from:..."
|
|
|
|
@echo
|
|
|
|
|
2020-11-24 01:38:18 +00:00
|
|
|
|
|
|
|
# NOTE: MUST update version number here prior to running 'make release' and edit this file!
|
2024-05-03 22:57:34 +00:00
|
|
|
VERS=v0.4.10
|
2020-11-24 01:38:18 +00:00
|
|
|
PACKAGE=main
|
|
|
|
GIT_COMMIT=`git rev-parse --short HEAD`
|
|
|
|
VERS_DATE=`date -u +%Y-%m-%d\ %H:%M`
|
|
|
|
VERS_FILE=version.go
|
|
|
|
|
|
|
|
release:
|
|
|
|
/bin/rm -f $(VERS_FILE)
|
|
|
|
@echo "// WARNING: auto-generated by Makefile release target -- run 'make release' to update" > $(VERS_FILE)
|
|
|
|
@echo "" >> $(VERS_FILE)
|
|
|
|
@echo "package $(PACKAGE)" >> $(VERS_FILE)
|
|
|
|
@echo "" >> $(VERS_FILE)
|
|
|
|
@echo "const (" >> $(VERS_FILE)
|
|
|
|
@echo " Version = \"$(VERS)\"" >> $(VERS_FILE)
|
|
|
|
@echo " GitCommit = \"$(GIT_COMMIT)\" // the commit JUST BEFORE the release" >> $(VERS_FILE)
|
|
|
|
@echo " VersionDate = \"$(VERS_DATE)\" // UTC" >> $(VERS_FILE)
|
|
|
|
@echo ")" >> $(VERS_FILE)
|
|
|
|
@echo "" >> $(VERS_FILE)
|
2021-08-29 09:55:02 +00:00
|
|
|
goimports -w $(VERS_FILE)
|
2020-11-24 01:38:18 +00:00
|
|
|
/bin/cat $(VERS_FILE)
|
|
|
|
git commit -am "$(VERS) release"
|
|
|
|
git tag -a $(VERS) -m "$(VERS) release"
|
|
|
|
git push
|
|
|
|
git push origin --tags
|
|
|
|
|