-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
85 lines (81 loc) · 2.79 KB
/
Makefile
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
# proofable
# Copyright (C) 2020 Southbank Software Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# @Author: guiguan
# @Date: 2019-06-03T13:42:50+10:00
# @Last modified by: guiguan
# @Last modified time: 2020-12-21T17:37:52+11:00
PROJECT_NAME := proofable
PROJECT_IMPORT_PATH := github.com/SouthbankSoftware/$(PROJECT_NAME)
APP_NAME := $(PROJECT_NAME)-cli
APP_VERSION ?= 0.0.0
PLAYGROUND_NAME := playground
PKGS := $(shell go list ./cmd/... ./pkg/...)
LD_FLAGS := -ldflags \
"-X $(PROJECT_IMPORT_PATH)/cmd/$(APP_NAME)/cmd.version=$(APP_VERSION)"
all: build
run:
go run $(LD_FLAGS) ./cmd/$(APP_NAME)
run-example:
go run $(LD_FLAGS) ./examples/example.go
build:
go build $(LD_FLAGS) ./cmd/$(APP_NAME)
build-regen: generate build
build-all:
go run src.techknowlogick.com/xgo --deps=https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2 --targets=linux/amd64,windows/amd64,darwin/amd64 --pkg cmd/$(APP_NAME) $(LD_FLAGS) $(PROJECT_IMPORT_PATH)
generate:
go generate $(PKGS)
test:
go test $(LD_FLAGS) $(PKGS)
test-dev:
# -test.v verbose
go test $(LD_FLAGS) -count=1 -test.v $(PKGS)
test-all: test-dev
cd node_sdk && npm i && npm t
clean:
go clean -testcache $(PKGS)
rm -f $(APP_NAME)* $(PLAYGROUND_NAME)*
.PHONY: playground
playground:
go run ./cmd/$(PLAYGROUND_NAME)/.
doc-init:
mkdir -p docs_output
cd docs_output && git clone https://github.com/SouthbankSoftware/proofable.git --single-branch --branch gh-pages gh-pages
cd node_sdk && npm install
make doc-node
ln -sf ../../docs_output/gh-pages/node_sdk/reference docs/node_sdk/
doc-dev:
mdbook serve -n 0.0.0.0
doc-build:
rm -rf docs_output/book
mdbook build
doc-deploy:
cd docs_output/gh-pages && git config pull.ff only && git pull
rsync -r --exclude=node_sdk/reference --exclude=.git --delete docs_output/book/html/ docs_output/gh-pages
doc-clean:
rm -rf docs/node_sdk/reference
rm -rf docs_output
# we use pkg.go.dev instead of this
doc-go:
# godoc doesn't support go module yet, so create a symlink in GOPATH as a workaround
mkdir -p $(GOPATH)/src/github.com/SouthbankSoftware
ln -sf $(PWD) $(GOPATH)/src/github.com/SouthbankSoftware
godoc -http=:6060
doc-node:
cd node_sdk && npm run doc
doc-anchortypes:
go run ./tools/anchor-types-updater