104 lines
2.6 KiB
Makefile
104 lines
2.6 KiB
Makefile
|
GITCOMMIT = $(shell git rev-list -1 HEAD)
|
||
|
GOVERSION = $(shell go version | cut -d' ' -f 3)
|
||
|
BUILDTIME = $(shell date -u --iso-8601=seconds)
|
||
|
VERSION = $(shell cat resources/VERSION)
|
||
|
|
||
|
# PATH=/usr/bin:$PATH go version
|
||
|
|
||
|
build:
|
||
|
# reset
|
||
|
GO111MODULE="off" go build -v
|
||
|
./wit-new-machine
|
||
|
|
||
|
release:
|
||
|
wit go update
|
||
|
go install -ldflags " \
|
||
|
-X main.GITCOMMIT=${GITCOMMIT} \
|
||
|
-X main.GOVERSION='${GOVERSION}' \
|
||
|
-X main.BUILDTIME='${BUILDTIME}' \
|
||
|
-X main.VERSION=${VERSION}"
|
||
|
~/go/bin/wit-new-machine
|
||
|
|
||
|
static:
|
||
|
# CGO_ENABLED=0 GO111MODULE="off" go build
|
||
|
# GO111MODULE="off" go build -v -x -ldflags="-d"
|
||
|
# GO111MODULE="off" go build -v -x -ldflags="-extldflags='-static -L /usr/lib/x86_64-linux-gnu/ -l /usr/lib/x86_64-linux-gnu/libayatana-appindicator3.so'"
|
||
|
GO111MODULE="off" go build -v -x -ldflags="-extldflags='-static'"
|
||
|
GO111MODULE="off" go build -v -x -ldflags="-extldflags=-static"
|
||
|
|
||
|
gomod-update:
|
||
|
wit go update
|
||
|
|
||
|
gomod-init:
|
||
|
-go mod init
|
||
|
go mod tidy -v
|
||
|
|
||
|
gomod-clean:
|
||
|
rm -f go.*
|
||
|
|
||
|
# https://golang.cafe/blog/golang-debugging-with-delve.html
|
||
|
# debug using 'delve'
|
||
|
debug:
|
||
|
dlv debug
|
||
|
|
||
|
push:
|
||
|
wit git push
|
||
|
|
||
|
tag-check:
|
||
|
wget https://proxy.golang.org/git.wit.org/wit/gui/@v/list
|
||
|
cat list
|
||
|
rm -f list
|
||
|
|
||
|
tag-version:
|
||
|
# git push --delete origin v0.6.15 # to delete a tag upstream
|
||
|
git diff --quiet
|
||
|
# go build # just an extra check to make sure the damn thing builds
|
||
|
# git tag v${VERSION}
|
||
|
git push --tags
|
||
|
|
||
|
# a custom go target name
|
||
|
generate:
|
||
|
go generate
|
||
|
|
||
|
build-all: build-darwin build-windows
|
||
|
|
||
|
# https://www.digitalocean.com/community/tutorials/how-to-build-go-executables-for-multiple-platforms-on-ubuntu-16-04
|
||
|
build-darwin:
|
||
|
env GOOS=darwin GOARCH=amd64 go build
|
||
|
|
||
|
build-windows:
|
||
|
env GOOS=windows GOARCH=amd64 go build
|
||
|
|
||
|
build-linux:
|
||
|
env GOOS=linux GOARCH=amd64 go build
|
||
|
|
||
|
gaper:
|
||
|
# 'gaper' is a simple and smart golang tool that just rebuilds every time you change a file
|
||
|
# go get -u github.com/maxcnunes/gaper
|
||
|
gaper
|
||
|
|
||
|
build-1-18:
|
||
|
PATH=/usr/lib/go-1.18/bin/:${PATH} make
|
||
|
|
||
|
deb:
|
||
|
cd debian && make
|
||
|
-wit mirrors
|
||
|
|
||
|
# From: https://github.com/liweiyi88/gosnakego # Sept 11 2022
|
||
|
#
|
||
|
# .PHONY: install release
|
||
|
#
|
||
|
# ARTIFACTS_DIR=artifacts/${VERSION}
|
||
|
# GITHUB_USERNAME=liweiyi88
|
||
|
#
|
||
|
# install:
|
||
|
# echo version=${VERSION}
|
||
|
# go install
|
||
|
#
|
||
|
# release:
|
||
|
# GOOS=windows GOARCH=amd64 go build -o $(ARTIFACTS_DIR)/gosnakego_windows_amd64.exe
|
||
|
# GOOS=darwin GOARCH=amd64 go build -o $(ARTIFACTS_DIR)/gosnakego_darwin_amd64
|
||
|
# GOOS=linux GOARCH=amd64 go build -o $(ARTIFACTS_DIR)/gosnakego_linux_amd64
|
||
|
# This uploads to github releases:
|
||
|
# ghr -u $(GITHUB_USERNAME) --replace ${VERSION} $(ARTIFACTS_DIR)
|