-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
216 lines (184 loc) · 7.45 KB
/
Makefile
File metadata and controls
216 lines (184 loc) · 7.45 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Builder Makefile
.PHONY: all build build-c build-lsp lsp test tests examples clean install install-lsp help tsan test-tsan extension ext ext-full
all: build
# Build the project
build: build-c
@echo "Building Builder..."
@dub build --build=release
# Build C libraries (SIMD, BLAKE3, and Serialization)
build-c:
@echo "Building C libraries..."
@mkdir -p bin/obj
@cd source/infrastructure/utils/simd/c && $(MAKE) clean && $(MAKE)
@cp source/infrastructure/utils/simd/c/*.o bin/obj/ 2>/dev/null || true
@cd source/infrastructure/utils/crypto/c && $(MAKE) clean && $(MAKE)
@cp source/infrastructure/utils/crypto/c/*.o bin/obj/ 2>/dev/null || true
@cd source/infrastructure/utils/serialization/c && $(MAKE) clean && $(MAKE)
@cp source/infrastructure/utils/serialization/c/*.o bin/obj/ 2>/dev/null || true
@cd source/infrastructure/parsing/treesitter/grammars && $(MAKE) clean && $(MAKE) stub
@mkdir -p bin/obj/treesitter
@cp bin/obj/treesitter/stub.o bin/obj/ts_loader.o
@echo "C libraries built"
# Build LSP server
build-lsp: build-c
@echo "Building Builder LSP server..."
@dub build --config=lsp --build=release
# Alias for build-lsp
lsp: build-lsp
# Build both builder and LSP server
build-all: build build-lsp
# Build debug version
debug:
@echo "Building debug version..."
@dub build --build=debug
# Run tests
test:
@echo "Running tests..."
@dub test
# Run tests with coverage
test-coverage:
@echo "Running tests with coverage..."
@./tests/run-tests.sh --coverage
# Run tests in parallel
test-parallel:
@echo "Running tests in parallel..."
@dub test -- --parallel
# Run full test suite with script
tests:
@echo "Running full test suite..."
@./tests/run-tests.sh
# Run all example projects
examples:
@echo "Testing all example projects..."
@./examples/run-all-examples.sh
# Clean build artifacts
clean:
@echo "Cleaning..."
@dub clean
@rm -rf bin/
@rm -rf .builder-cache/
@rm -f *.lst
@cd source/infrastructure/utils/simd/c && $(MAKE) clean 2>/dev/null || true
@cd source/infrastructure/utils/crypto/c && $(MAKE) clean 2>/dev/null || true
@find . -name "*.o" -delete
@find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
# Install to system
install: build
@echo "Installing to /usr/local/bin..."
@cp bin/bldr /usr/local/bin/
@echo "Installed successfully!"
# Install LSP server
install-lsp: build-lsp
@echo "Installing bldr LSP to /usr/local/bin..."
@cp bin/bldr-lsp /usr/local/bin/
@echo "LSP server installed successfully!"
# Install both bldr and LSP server
install-all: build-all
@echo "Installing to /usr/local/bin..."
@cp bin/bldr /usr/local/bin/
@cp bin/bldr-lsp /usr/local/bin/
@echo "Installed successfully!"
# Uninstall from system
uninstall:
@echo "Uninstalling..."
@rm -f /usr/local/bin/bldr
@rm -f /usr/local/bin/bldr-lsp
@echo "Uninstalled successfully!"
# Run benchmarks
bench:
@echo "Running benchmarks..."
@dub test -- --filter="bench"
# Build with Thread Sanitizer (requires LDC)
tsan:
@echo "Building with Thread Sanitizer (TSan)..."
@echo "Note: Requires LDC compiler (use: dub build --compiler=ldc2 --build=tsan)"
@dub build --compiler=ldc2 --build=tsan
# Run tests with Thread Sanitizer
test-tsan:
@echo "Running tests with Thread Sanitizer (TSan)..."
@echo "Note: This will detect data races and threading issues"
@./tools/run-tsan-tests.sh
# Format code
fmt:
@echo "Formatting code..."
@find source tests -name "*.d" -exec dfmt -i {} \;
# Generate documentation
docs:
@./tools/generate-docs.sh
# Open documentation in browser
docs-open: docs
@echo "Opening documentation in browser..."
@open docs/api/index.html || xdg-open docs/api/index.html || sensible-browser docs/api/index.html
# Serve documentation on local web server
docs-serve:
@echo "Starting documentation server on http://localhost:8000..."
@echo "Press Ctrl+C to stop"
@python3 -m http.server --directory docs/api 8000
# Clean documentation
docs-clean:
@echo "Cleaning documentation..."
@rm -rf docs/api
@echo "Documentation cleaned"
# Package VS Code extension with LSP server
extension: build-lsp
@echo "Packaging VS Code extension..."
@mkdir -p tools/vscode/builder-lang/bin
@cp bin/bldr-lsp tools/vscode/builder-lang/bin/
@cd tools/vscode/builder-lang && npm install && npm run compile && npx vsce package --allow-missing-repository
@echo "Extension packaged: tools/vscode/builder-lang/builder-lang-*.vsix"
# Install VS Code extension (requires builder to be built)
install-extension: extension
@echo "Installing VS Code extension..."
@code --install-extension tools/vscode/builder-lang/builder-lang-*.vsix --force
@echo "Extension installed! Reload VS Code to activate."
# Quick extension install/update (no LSP rebuild, just repackage and install)
ext:
@echo "Building and installing VS Code extension..."
@cd tools/vscode/builder-lang && npm install --silent && npm run compile
@cd tools/vscode/builder-lang && npx vsce package --allow-missing-repository -o builder-lang.vsix
@code --install-extension tools/vscode/builder-lang/builder-lang.vsix --force
@rm -f tools/vscode/builder-lang/builder-lang.vsix
@echo "✓ Extension installed! Reload VS Code (Cmd+Shift+P → 'Reload Window')"
# Extension with LSP (full rebuild)
ext-full: build-lsp
@echo "Building full extension with LSP..."
@mkdir -p tools/vscode/builder-lang/bin
@cp bin/bldr-lsp tools/vscode/builder-lang/bin/
@cd tools/vscode/builder-lang && npm install --silent && npm run compile
@cd tools/vscode/builder-lang && npx vsce package --allow-missing-repository -o builder-lang.vsix
@code --install-extension tools/vscode/builder-lang/builder-lang.vsix --force
@rm -f tools/vscode/builder-lang/builder-lang.vsix
@echo "✓ Extension with LSP installed! Reload VS Code (Cmd+Shift+P → 'Reload Window')"
# Show help
help:
@echo "bldr Makefile"
@echo ""
@echo "Targets:"
@echo " make build - Build release version"
@echo " make build-lsp - Build LSP server"
@echo " make lsp - Alias for build-lsp"
@echo " make build-all - Build both bldr and LSP server"
@echo " make debug - Build debug version"
@echo " make test - Run tests (basic)"
@echo " make tests - Run full test suite"
@echo " make test-coverage - Run tests with coverage"
@echo " make test-parallel - Run tests in parallel"
@echo " make test-tsan - Run tests with Thread Sanitizer (requires LDC)"
@echo " make tsan - Build with Thread Sanitizer"
@echo " make bench - Run benchmarks"
@echo " make examples - Test all example projects"
@echo " make clean - Clean build artifacts"
@echo " make install - Install bldr to /usr/local/bin"
@echo " make install-lsp - Install LSP server to /usr/local/bin"
@echo " make install-all - Install both bldr and LSP server"
@echo " make uninstall - Uninstall from system"
@echo " make ext - Quick install/update VS Code extension"
@echo " make ext-full - Full extension build with LSP server"
@echo " make extension - Package VS Code extension with LSP"
@echo " make install-extension - Build and install VS Code extension"
@echo " make fmt - Format code"
@echo " make docs - Generate DDoc documentation"
@echo " make docs-open - Generate and open documentation"
@echo " make docs-serve - Serve documentation on localhost:8000"
@echo " make docs-clean - Clean documentation"
@echo " make help - Show this help"