-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
124 lines (101 loc) · 3.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# === Development ===
# build neva cli for host OS and put to the PATH as well as replaces stdlib
.PHONY: install
install:
@go build -ldflags="-s -w" ./cmd/neva && \
rm -rf $HOME/neva/std && \
rm -rf /usr/local/bin/neva && \
mv neva /usr/local/bin/neva
# generate go parser from antlr grammar
.PHONY: antlr
antlr:
@cd internal/compiler/parser && \
antlr4 -Dlanguage=Go -no-visitor -package parsing ./neva.g4 -o generated
# run lint
.PHONY: lint
lint:
golangci-lint run ./...
# check potential nil-derefs
.PHONY: nilaway
nilaway:
nilaway \
-include-pkgs="github.com/nevalang/neva/internal" \
./...
# === Release Build ===
# build neva cli for all target platforms
.PHONY: build
build:
$(MAKE) build-darwin-amd64
$(MAKE) build-darwin-arm64
$(MAKE) build-linux-amd64
$(MAKE) build-linux-arm64
$(MAKE) build-linux-loong64
$(MAKE) build-windows-amd64
$(MAKE) build-windows-arm64
# build neva cli for amd64 mac
.PHONY: build-darwin-amd64
build-darwin-amd64:
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o neva-darwin-amd64 ./cmd/neva
# build neva cli for arm64 mac
.PHONY: build-darwin-arm64
build-darwin-arm64:
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o neva-darwin-arm64 ./cmd/neva
# build neva cli for amd64 linux
.PHONY: build-linux-amd64
build-linux-amd64:
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o neva-linux-amd64 ./cmd/neva
# build neva cli for arm64 linux
.PHONY: build-linux-arm64
build-linux-arm64:
@GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o neva-linux-arm64 ./cmd/neva
# build neva cli for loong64 linux
.PHONY: build-linux-loong64
build-linux-loong64:
@GOOS=linux GOARCH=loong64 go build -ldflags="-s -w" -o neva-linux-loong64 ./cmd/neva
# build neva cli for amd64 windows
.PHONY: build-windows-amd64
build-windows-amd64:
@GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o neva-windows-amd64.exe ./cmd/neva
# build neva cli for arm64 windows
.PHONY: build-windows-arm64
build-windows-arm64:
@GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -o neva-windows-arm64.exe ./cmd/neva
# === LSP ===
# build neva lsp for all target platforms
.PHONY: build-lsp
build-lsp:
$(MAKE) build-lsp-darwin-amd64
$(MAKE) build-lsp-darwin-arm64
$(MAKE) build-lsp-linux-amd64
$(MAKE) build-lsp-linux-arm64
$(MAKE) build-lsp-linux-loong64
$(MAKE) build-lsp-windows-amd64
$(MAKE) build-lsp-windows-arm64
# build neva lsp for amd64 mac
.PHONY: build-lsp-darwin-amd64
build-lsp-darwin-amd64:
@GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o neva-lsp-darwin-amd64 ./cmd/lsp
# build neva lsp for arm64 mac
.PHONY: build-lsp-darwin-arm64
build-lsp-darwin-arm64:
@GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o neva-lsp-darwin-arm64 ./cmd/lsp
# build neva lsp for amd64 linux
.PHONY: build-lsp-linux-amd64
build-lsp-linux-amd64:
@GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o neva-lsp-linux-amd64 ./cmd/lsp
# build neva lsp for arm64 linux
.PHONY: build-lsp-linux-arm64
build-lsp-linux-arm64:
@GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o neva-lsp-linux-arm64 ./cmd/lsp
# build neva lsp for loong64 linux
.PHONY: build-lsp-linux-loong64
build-lsp-linux-loong64:
@GOOS=linux GOARCH=loong64 go build -ldflags="-s -w" -o neva-lsp-linux-loong64 ./cmd/lsp
# build neva lsp for amd64 windows
.PHONY: build-lsp-windows-amd64
build-lsp-windows-amd64:
@GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o neva-lsp-windows-amd64.exe ./cmd/lsp
# build neva lsp for arm64 windows
.PHONY: build-lsp-windows-arm64
build-lsp-windows-arm64:
@GOOS=windows GOARCH=arm64 go build -ldflags="-s -w" -o neva-lsp-windows-arm64.exe ./cmd/lsp