forked from Fantom-foundation/go-opera
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
72 lines (57 loc) · 2.09 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
.PHONY: all
all: x1
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
GOPROXY ?= "https://proxy.golang.org,direct"
.PHONY: x1
x1:
GIT_COMMIT=`git rev-list -1 HEAD 2>/dev/null || echo ""` && \
GIT_DATE=`git log -1 --date=short --pretty=format:%ct 2>/dev/null || echo ""` && \
GOPROXY=$(GOPROXY) \
go build \
-ldflags "-s -w -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=$${GIT_DATE}" \
-o build/x1 \
./cmd/opera
install:
system/x1-pre-install.sh
install -d $(DESTDIR)$(PREFIX)/lib
install -m 0777 build/x1 $(DESTDIR)$(PREFIX)/bin
ifneq ("$(wildcard $(/etc/systemd/system))","")
install -m 644 system/lib/systemd/system/x1.service $(DESTDIR)/lib/systemd/system
endif
install -d $(DESTDIR)$(PREFIX)/share/x1/configs/testnet
install -m 644 system/usr/share/x1/configs/testnet/full-node.toml $(DESTDIR)$(PREFIX)/share/x1/configs/testnet/full-node.toml
install -m 644 system/usr/share/x1/configs/testnet/api-node.toml $(DESTDIR)$(PREFIX)/share/x1/configs/testnet/api-node.toml
install -m 644 system/usr/share/x1/configs/testnet/archive-node.toml $(DESTDIR)$(PREFIX)/share/x1/configs/testnet/archive-node.toml
system/x1-post-install.sh
TAG ?= "latest"
.PHONY: x1-image
x1-image:
docker build \
--network=host \
-f ./docker/Dockerfile.opera -t "x1:$(TAG)" .
.PHONY: test
test:
go test ./...
.PHONY: coverage
coverage:
go test -coverprofile=cover.prof $$(go list ./... | grep -v '/gossip/contract/' | grep -v '/gossip/emitter/mock' | xargs)
go tool cover -func cover.prof | grep -e "^total:"
.PHONY: fuzz
fuzz:
CGO_ENABLED=1 \
mkdir -p ./fuzzing && \
go run github.com/dvyukov/go-fuzz/go-fuzz-build -o=./fuzzing/gossip-fuzz.zip ./gossip && \
go run github.com/dvyukov/go-fuzz/go-fuzz -workdir=./fuzzing -bin=./fuzzing/gossip-fuzz.zip
.PHONY: clean
clean:
rm -fr ./build/*
.PHONY: sfc
sfc:
if [ ! -d ../x1-sfc ]; then \
echo "x1-sfc not found in the parent directory. Please git clone https://github.com/FairCrypto/x1-sfc "; \
exit 1; \
else \
go generate ./...; \
fi