golang-examples/Makefile

108 lines
3.5 KiB
Makefile
Raw Permalink Normal View History

2019-06-13 19:53:47 -05:00
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)
# GO111MODULE=on
2019-06-13 19:53:47 -05:00
# try go get github.com/ahmetb/govvv
# this will add branch info & build RFC3339 date also
build:
# shell things
cd example-nohup; go install # minimum golang 'cmd'
cd example-expect; go install # traditional 'expect' shell automation
cd example-shell; go install # a tty wrapper
cd example-gocui-mouse; go install # mouse interaction
cd example-gocui-active; go install # ytalk
cd example-gocui-colorstrue; go install # shell colors
cd example-gocui-dynamic; go install # interactive movement
# GUI things
cd example-systray; go install # an example systray menu (cross platform)
cd example-ui-splash; go install # an example GUI with drop down menus, etc
cd example-ui-controlgallery; go install # an example GUI with drop down menus, etc
cd example-ui-radiobutton; go install # slidebars, lists, radio buttons
cd example-ui-table; go install # spreadsheet
cd example-ui-show-hide; go install # toggle hide, show
# wit/gui things
cd example-gui; go install # an example using the wit/gui wrapper
# misc
cd example-lookupAAAA; go install # nslookup
cd example-json-decode; go install # raw golang byte handling
cd example-ssh; go install # scp example
cd example-packr; go install # pack a directory into a go binary
# golang things
cd example-flag; go install # process argv
cd example-pprof; go install # dump out go process internals
cd example-protobuf; go install # convert json into golang protobuf struct
cd example-bench-fast-timer; go install # time golang channels
cd example-bench-readWriteOps; go install # uses channels to time select
# witgoget='-v -t' make prep
# witgoget='-v -t -u' make prep # to update
prep:
witgoget='-v -t' make base
update:
witgoget='-v -t -u' make base
base:
make -C example-nohup prep
make -C example-expect prep
make -C example-shell prep
make -C example-gocui-mouse prep
make -C example-systray prep
make -C example-lookupAAAA prep
make -C example-gui prep
init:
sudo make -C example-systray init
sub-make:
# shell things
make -C example-expect # traditional 'expect' shell automation
make -C example-shell # a tty wrapper
make -C example-gocui-mouse # mouse interaction
2019-06-13 19:53:47 -05:00
debug:
go build -ldflags "-X main.GITCOMMIT=${GITCOMMIT} -X main.GOVERSION='${GOVERSION}' -X main.BUILDTIME='${BUILDTIME}' -X main.VERSION=${VERSION}"
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
#### NEVER DO THIS. THIS APPEARS TO INDUCE INSTABILITY IN GTK
bad-run:
#### NEVER DO THIS. THIS APPEARS TO INDUCE INSTABILITY IN GTK
# go run *.go
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
cp .git/refs/tags/v${VERSION} resources/tags/
scp resources/VERSION root@mirrors.wit.com:/data/mirrors/cloud/control-panel/
scp resources/VERSION root@mirrors.wit.com:/data/mirrors/cloud/control-panel/linux/
# should update every go dependancy (?)
update:
git pull
go get -v -t -u .
diff:
git diff
# 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