summaryrefslogtreecommitdiff
path: root/Makefile
blob: 1933d153880232e713c03a19fd0592e49cac0d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)

# make build     # go build   using your git cloned repos (GO111MODULE=off)
# make install   # go install using your git cloned repos (GO111MODULE=off)
# make gocui     # try the ncurses gui plugin
# make andlabs   # try the andlabs gui plugin (uses GTK)

default: install
	~/go/bin/forge --version

# This will re-generate ALL of the needed autogenerated .pb.go files
generate: clean
	go mod init
	go mod tidy
	go generate

required:
	go install go.wit.com/apps/autogenpb@latest
	go install go.wit.com/apps/go-mod-clean@latest
	go install go.wit.com/apps/go-clone@latest
	go install golang.org/x/tools/cmd/goimports@latest

vet:
	@GO111MODULE=off go vet
	@echo this go binary package builds okay

build: goimports vet plugin
	GO111MODULE=off go build \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

install: goimports plugin
	GO111MODULE=off go install \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
	cp -f ~/go/bin/forge ~/go/bin/last.forge # this is a hack so that go-deb can build a .deb file for forge # TODO: remove this

install-verbose: goimports vet plugin
	GO111MODULE=off go install -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

install-raw: goimports vet plugin
	go install \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"

plugin:
	rm -f resources/*.so
	# -cp ../../toolkits/gocui/gocui.so resources/

GTK: clean install
	forge --gui andlabs

GTK-verbose: clean install
	forge --gui andlabs --gui-verbose

CUI: install
	forge --gui gocui

CUI-verbose: install
	forge --gui gocui --gui-verbose >/tmp/forge.log 2>&1

goimports:
	reset
	goimports -w *.go
	@# // to globally reset paths:
	@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go

clean:
	-rm -f forge go.*
	# -rm -f ~/go/src/repos.pb
	go-mod-clean purge

identify-protobuf:
	autogenpb --identify ~/go/src/repos.pb

devel:
	forge clean devel --force --verbose

pull: install
	FORGE_URL="https://forge.grid.wit.com/" forge pull check

# cloudflare blocks POST due to captcha checks / human detection?
# POST must be direct socket. probably for the best anyway
submit:
	FORGE_URL="https://forge.grid.wit.com/" forge patch submit "forge auto commit"

commit:
	FORGE_URL="https://forge.grid.wit.com/" forge commit --all

check: install
	FORGE_URL="https://forge.grid.wit.com/" forge patch check

doc:
	echo "/*" > doc.go
	forge -h >> doc.go
	echo "*/" >> doc.go
	echo "package main" >> doc.go