-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (44 loc) · 2.27 KB
/
Copy pathMakefile
File metadata and controls
64 lines (44 loc) · 2.27 KB
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
.DELETE_ON_ERROR:
GO_FILES=$(shell find . -name '*.go')
UI_SOURCES=$(shell find ui -name '*.ts' -not -path 'ui/node_modules/*')
UI_CONFIG=ui/package.json ui/vite.config.ts ui/tsconfig.json
.PHONY: all clean test test-go test-ui lint-ui analyze-ui format-ui generate check_tools
all: check_tools bin/bpf_extractor bin/sgmatcher bin/playground_server
ui/node_modules/.npminstalled: ui/package.json ui/package-lock.json check_tools
cd ui && npm install && touch node_modules/.npminstalled
check_tools:
@command -v protoc > /dev/null || (echo "ERROR: protoc not found in PATH. Please install protoc or adjust your PATH." && exit 1)
@command -v npm > /dev/null || (echo "ERROR: npm not found in PATH. Please install npm or adjust your PATH." && exit 1)
@command -v go > /dev/null || (echo "ERROR: go not found in PATH. Please install go or adjust your PATH." && exit 1)
clean:
rm -f bin/* cmd/playground_server/embed/demo.css.gz
rm -rf cmd/playground_server/embed/ui
rm -rf examples/*/graph
rm -rf ui/proto
test-go:
go test ./...
test-ui: ui/node_modules/.npminstalled lint-ui analyze-ui
cd ui && npm test
lint-ui: ui/node_modules/.npminstalled
cd ui && npm run lint
analyze-ui: ui/node_modules/.npminstalled
cd ui && npm run analyze
format-ui: ui/node_modules/.npminstalled
cd ui && npm run format
test: test-go test-ui
generate:
go generate ./proto/playground/
cmd/playground_server/embed/ui/playground_app.js: $(UI_SOURCES) $(UI_CONFIG) ui/node_modules/.npminstalled check_tools
cd ui && npm run build
cmd/playground_server/embed/ui/playground_app.js.gz: cmd/playground_server/embed/ui/playground_app.js
gzip -f -k $<
cmd/playground_server/embed/demo.css.gz: cmd/playground_server/embed/demo.css
gzip -f -k $<
cmd/playground_server/embed/ui/playground_app.js.map.gz: cmd/playground_server/embed/ui/playground_app.js.map
gzip -f -k $<
bin/bpf_extractor: $(GO_FILES)
go build -o ./bin/bpf_extractor ./cmd/bpf_extractor/
bin/sgmatcher: $(GO_FILES)
go build -o ./bin/sgmatcher ./cmd/sgmatcher/
bin/playground_server: $(GO_FILES) cmd/playground_server/embed/ui/playground_app.js cmd/playground_server/embed/ui/playground_app.js.gz cmd/playground_server/embed/ui/playground_app.js.map.gz cmd/playground_server/embed/demo.css.gz
go build -o ./bin/playground_server ./cmd/playground_server/