92 lines
2.1 KiB
Makefile
92 lines
2.1 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
|
|
|
|
run: new-build
|
|
~/go/bin/wit-debian-gui
|
|
|
|
new-build:
|
|
go mod edit -replace git.wit.org/wit/gui=/home/jcarr/go/src/git.wit.org/wit/gui
|
|
# to update go.mod to master:
|
|
# go get git.wit.org/wit/gui@master
|
|
go install -ldflags " \
|
|
-X main.GITCOMMIT=${GITCOMMIT} \
|
|
-X main.GOVERSION='${GOVERSION}' \
|
|
-X main.BUILDTIME='${BUILDTIME}' \
|
|
-X main.VERSION=${VERSION}"
|
|
|
|
# to build the old way
|
|
build:
|
|
GO111MODULE="off" go install -ldflags " \
|
|
-X main.GITCOMMIT=${GITCOMMIT} \
|
|
-X main.GOVERSION='${GOVERSION}' \
|
|
-X main.BUILDTIME='${BUILDTIME}' \
|
|
-X main.VERSION=${VERSION}"
|
|
|
|
godoc:
|
|
godoc -http=:6060
|
|
|
|
gomod-update:
|
|
wit go update
|
|
|
|
gomod-init:
|
|
go mod init
|
|
go mod tidy
|
|
|
|
gomod-clean:
|
|
rm -f go.*
|
|
|
|
sudo: build
|
|
sudo ~/go/bin/wit-debian-gui
|
|
|
|
# https://golang.cafe/blog/golang-debugging-with-delve.html
|
|
# debug using 'delve'
|
|
debug:
|
|
dlv debug
|
|
|
|
push:
|
|
wit git push
|
|
|
|
prep:
|
|
apt install -y libgtk-3-dev
|
|
apt install -y libappindicator3-dev
|
|
apt install -y xterm
|
|
|
|
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
|
|
|
|
icon:
|
|
go get -v github.com/cratonica/2goarray
|
|
go install github.com/cratonica/2goarray
|
|
echo "//+build linux darwin" > icon.go
|
|
echo >> icon.go
|
|
cat resources/wit.png | 2goarray Data icon >> icon.go
|
|
|
|
# a custom go target name
|
|
generate:
|
|
go generate
|
|
|
|
build-all:
|
|
GOOS=linux GOARCH=386 go build -o bin/linux.x32.bin
|
|
GOOS=freebsd GOARCH=386 go build -o bin/freebsd.x32.bin
|
|
GOOS=darwin GOARCH=386 go build -o bin/darwin.x32.bin
|
|
|
|
# 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
|
|
|
|
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
|