forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (84 loc) · 2.56 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
GOBUILD=go build -trimpath
ifeq ("$(shell go env GOARCH || true)", "arm64")
# rbspy doesn't work on arm afaik
ENABLED_SPIES ?= "pyspy"
# this makes it work better on M1 machines
GODEBUG=asyncpreemptoff=1
else
ENABLED_SPIES ?= "rbspy,pyspy"
endif
EMBEDDED_ASSETS ?= ""
EMBEDDED_ASSETS_DEPS ?= "assets-release"
EXTRA_LDFLAGS ?= ""
ifndef $(GOPATH)
GOPATH=$(shell go env GOPATH || true)
export GOPATH
endif
.PHONY: all
all: build
.PHONY: build
build:
$(GOBUILD) -tags $(ENABLED_SPIES) -ldflags "$(EXTRA_LDFLAGS) $(shell scripts/generate-build-flags.sh $(EMBEDDED_ASSETS))" -o ./bin/pyroscope ./cmd/pyroscope
.PHONY: build-release
build-release: embedded-assets
EMBEDDED_ASSETS=true $(MAKE) build
.PHONY: build-rust-dependencies
build-rust-dependencies:
cd third_party/rustdeps && cargo build --release
.PHONY: test
test:
go list ./... | xargs -I {} sh -c "go test {} || exit 255"
.PHONY: server
server:
bin/pyroscope server --log-level debug --badger-log-level error --storage-path tmp/pyroscope-storage
.PHONY: agent
agent:
bin/pyroscope agent
.PHONY: install-web-dependencies
install-web-dependencies:
yarn install
.PHONY: assets
assets: install-web-dependencies
$(shell yarn bin webpack) --config scripts/webpack/webpack.dev.js
.PHONY: assets-watch
assets-watch: install-web-dependencies
$(shell yarn bin webpack) --config scripts/webpack/webpack.dev.js --watch
.PHONY: assets
assets-release: install-web-dependencies
rm -rf webapp/public
NODE_ENV=production $(shell yarn bin webpack) --config scripts/webpack/webpack.prod.js
.PHONY: embedded-assets
embedded-assets: install-dev-tools $(shell echo $(EMBEDDED_ASSETS_DEPS))
$(GOPATH)/bin/pkger -o pkg/server
.PHONY: lint
lint:
revive -config revive.toml -formatter stylish ./...
.PHONY: unused
unused:
staticcheck -f stylish -unused.whole-program ./...
.PHONY: install-dev-tools
install-dev-tools:
cat tools/tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI {} go install {}
.PHONY: dev
dev:
goreman -exit-on-error -f scripts/dev-procfile start
.PHONY: godoc
godoc:
sleep 5 && open http://localhost:8090/pkg/github.com/pyroscope-io/pyroscope/ &
godoc -http :8090
.PHONY: go-deps-graph
go-deps-graph:
sh scripts/dependency-graph.sh
open -a "/Applications/Google Chrome.app" tmp/go-deps-graph.svg
.PHONY: clean
clean:
rm -rf tmp/pyroscope-storage
.PHONY: update-contributors
update-contributors:
$(shell yarn bin contributor-faces) .
.PHONY: update-changelog
update-changelog:
$(shell yarn bin conventional-changelog) -i CHANGELOG.md -s
.PHONY: docker-dev
docker-dev:
docker build . --tag pyroscope/pyroscope:dev