-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
507 lines (446 loc) · 20.9 KB
/
Makefile
File metadata and controls
507 lines (446 loc) · 20.9 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# Zipora Project Makefile
# Comprehensive build and test automation for debug/release modes with feature management
#
# Features:
# - Default: simd, mmap, zstd, serde, lz4, async
# - Optional: ffi
# - Nightly: avx512
#
# Usage:
# make # Build and test everything (stable features only)
# make all # Same as default
# make build # Build debug + release (stable features)
# make test # Test debug + release (stable features)
# make build_nightly # Build with all features including nightly
# make test_nightly # Test with all features including nightly
.PHONY: all build test build_nightly test_nightly clean help
.PHONY: sanity sanity_stable sanity_nightly
.PHONY: build_debug build_release build_nightly_debug build_nightly_release
.PHONY: test_debug test_release test_nightly_debug test_nightly_release
.PHONY: bench bench_fsa bench_serialization bench_io bench_all bench_all_nightly
.PHONY: bench_release bench_nightly test_simd_base64 test_simd_base64_nightly
.PHONY: safety_tests miri_tests miri_full format clippy doc
# =============================================================================
# CONFIGURATION
# =============================================================================
# Feature sets
# Default features (simd, mmap, zstd, serde, lz4, async — all enabled by default)
STABLE_FEATURES :=
# Nightly: default + avx512
NIGHTLY_FEATURES := --features avx512
# All features including ffi
ALL_FEATURES := --all-features
# Cargo commands
CARGO := cargo
CARGO_NIGHTLY := cargo +nightly
CARGO_MIRI := cargo +nightly miri
# Test exclusions
EXCLUDE_BENCH_TESTS := --exclude-from-test '*bench*'
# =============================================================================
# DEFAULT TARGET
# =============================================================================
# Default: build and test everything with stable features
all: build test
@echo ""
@echo "🎉 All build and test targets completed successfully!"
@echo ""
@echo "📊 Summary:"
@echo " ✅ Debug build (stable features)"
@echo " ✅ Release build (stable features)"
@echo " ✅ Debug tests (stable features, no benchmarks)"
@echo " ✅ Release tests (stable features, with SIMD Base64 tests and benchmarks)"
@echo ""
@echo "💡 Available targets:"
@echo " make bench_all # All stable benchmarks"
@echo " make bench_all_nightly # All benchmarks with nightly features"
@echo " make test_simd_base64 # SIMD Base64 comprehensive tests"
@echo " make test_nightly # Build and test with nightly features"
# =============================================================================
# BUILD TARGETS
# =============================================================================
# Build both debug and release with stable features
build: build_debug build_release
@echo "✅ All stable builds completed"
# Build both debug and release with nightly features
build_nightly: build_nightly_debug build_nightly_release
@echo "✅ All nightly builds completed"
# Individual build targets - Debug mode (stable)
build_debug:
@echo "🔨 Building debug mode with stable features..."
$(CARGO) build $(STABLE_FEATURES)
@echo "✅ Debug build (stable) completed"
# Individual build targets - Release mode (stable)
build_release:
@echo "🔨 Building release mode with stable features..."
$(CARGO) build --release $(STABLE_FEATURES)
@echo "✅ Release build (stable) completed"
# Individual build targets - Debug mode (nightly)
build_nightly_debug:
@echo "🌙 Building debug mode with nightly features..."
$(CARGO_NIGHTLY) build $(NIGHTLY_FEATURES)
@echo "✅ Debug build (nightly) completed"
# Individual build targets - Release mode (nightly)
build_nightly_release:
@echo "🌙 Building release mode with nightly features..."
$(CARGO_NIGHTLY) build --release $(NIGHTLY_FEATURES)
@echo "✅ Release build (nightly) completed"
# =============================================================================
# TEST TARGETS
# =============================================================================
# Test both debug and release with stable features
test: test_debug test_release
@echo "✅ All stable tests completed"
# Test both debug and release with nightly features
test_nightly: test_nightly_debug test_nightly_release
@echo "✅ All nightly tests completed"
# Individual test targets - Debug mode (stable, no benchmarks)
test_debug:
@echo "🧪 Running debug tests with stable features (excluding benchmarks)..."
$(CARGO) test $(STABLE_FEATURES) --lib --bins --tests
@echo "✅ Debug tests (stable) completed"
# Individual test targets - Release mode (stable, with benchmarks)
test_release:
@echo "🧪 Running release tests with stable features (including benchmarks)..."
$(CARGO) test --release $(STABLE_FEATURES) --lib --bins --tests
@echo "🧪 Running SIMD Base64 comprehensive tests..."
$(CARGO) test --release $(STABLE_FEATURES) --test simd_base64_tests -- --nocapture
@echo "🧪 Running I/O & Serialization performance tests..."
$(CARGO) test --release $(STABLE_FEATURES) test_stream_performance_comparison -- --nocapture
$(CARGO) test --release $(STABLE_FEATURES) test_combined_stream_operations -- --nocapture
@echo "🧪 Running stable benchmarks (excluding avx512_bench and cpp_comparison)..."
$(CARGO) test --release $(STABLE_FEATURES) --bench benchmark --bench benchmark_rank_select --bench simd_rank_select_bench --bench dictionary_optimization_bench --bench cache_bench --bench secure_memory_pool_bench --bench specialized_containers_bench --bench rank_select_bench --bench sortable_str_vec_bench --bench fsa_infrastructure_bench --bench memory_performance --bench memory_pools_bench --bench adaptive_mmap_bench --bench simple_benchmark --bench sortable_str_vec_optimized --bench valvec32_performance_bench --bench entropy_bench --bench dict_zip_bench
@echo "✅ Release tests (stable) completed"
# Individual test targets - Debug mode (nightly, no benchmarks)
test_nightly_debug:
@echo "🌙 Running debug tests with nightly features (excluding benchmarks)..."
$(CARGO_NIGHTLY) test $(NIGHTLY_FEATURES) --lib --bins --tests
@echo "✅ Debug tests (nightly) completed"
# Individual test targets - Release mode (nightly, with benchmarks)
test_nightly_release:
@echo "🌙 Running release tests with nightly features (including benchmarks)..."
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) --lib --bins --tests
@echo "🧪 Running SIMD Base64 comprehensive tests with nightly features..."
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) --test simd_base64_tests -- --nocapture
@echo "🧪 Running I/O & Serialization performance tests..."
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) test_stream_performance_comparison -- --nocapture
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) test_combined_stream_operations -- --nocapture
@echo "🧪 Running nightly benchmarks (including avx512_bench, excluding cpp_comparison)..."
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) --bench benchmark --bench benchmark_rank_select --bench simd_rank_select_bench --bench dictionary_optimization_bench --bench cache_bench --bench avx512_bench --bench secure_memory_pool_bench --bench specialized_containers_bench --bench rank_select_bench --bench sortable_str_vec_bench --bench fsa_infrastructure_bench --bench memory_performance --bench memory_pools_bench --bench adaptive_mmap_bench --bench simple_benchmark --bench sortable_str_vec_optimized --bench valvec32_performance_bench --bench entropy_bench --bench dict_zip_bench
@echo "✅ Release tests (nightly) completed"
# =============================================================================
# SPECIALIZED TEST TARGETS
# =============================================================================
# Run benchmarks only
bench:
@echo "⚡ Running benchmarks..."
$(CARGO) bench $(STABLE_FEATURES)
@echo "✅ Benchmarks completed"
# Run FSA infrastructure benchmarks specifically
bench_fsa:
@echo "⚡ Running FSA infrastructure benchmarks..."
$(CARGO) bench $(STABLE_FEATURES) --bench fsa_infrastructure_bench
@echo "✅ FSA benchmarks completed"
# Run I/O & Memory benchmarks specifically
bench_serialization:
@echo "⚡ Running I/O & Memory benchmarks..."
$(CARGO) bench --release $(STABLE_FEATURES) --bench memory_performance --bench memory_pools_bench --bench adaptive_mmap_bench
@echo "✅ I/O & Memory benchmarks completed"
# Run I/O & Memory performance tests specifically
bench_io:
@echo "⚡ Running I/O & Memory performance tests..."
$(CARGO) test --release $(STABLE_FEATURES) test_stream_performance_comparison -- --nocapture
$(CARGO) test --release $(STABLE_FEATURES) test_combined_stream_operations -- --nocapture
$(CARGO) test --release $(STABLE_FEATURES) test_stress_operations -- --nocapture
@echo "⚡ Running I/O & Memory benchmarks..."
$(CARGO) bench --release $(STABLE_FEATURES) --bench memory_performance --bench memory_pools_bench --bench adaptive_mmap_bench
@echo "✅ I/O performance tests and benchmarks completed"
# Run all benchmarks in release mode
bench_release:
@echo "⚡ Running all benchmarks in release mode..."
$(CARGO) bench --release $(STABLE_FEATURES)
@echo "✅ Release benchmarks completed"
# Run nightly benchmarks with AVX-512
bench_nightly:
@echo "🌙 Running nightly benchmarks with AVX-512..."
$(CARGO_NIGHTLY) bench --release $(NIGHTLY_FEATURES)
@echo "✅ Nightly benchmarks completed"
# Run all available benchmarks explicitly (comprehensive test)
bench_all:
@echo "⚡ Running all available benchmarks..."
$(CARGO) bench --release $(STABLE_FEATURES) \
--bench benchmark \
--bench benchmark_rank_select \
--bench simd_rank_select_bench \
--bench dictionary_optimization_bench \
--bench cache_bench \
--bench secure_memory_pool_bench \
--bench specialized_containers_bench \
--bench rank_select_bench \
--bench sortable_str_vec_bench \
--bench fsa_infrastructure_bench \
--bench memory_performance \
--bench memory_pools_bench \
--bench adaptive_mmap_bench \
--bench simple_benchmark \
--bench sortable_str_vec_optimized \
--bench valvec32_performance_bench \
--bench entropy_bench \
--bench dict_zip_bench
@echo "✅ All stable benchmarks completed"
# Run all available benchmarks including nightly-only ones
bench_all_nightly:
@echo "🌙 Running all available benchmarks with nightly features..."
$(CARGO_NIGHTLY) bench --release $(NIGHTLY_FEATURES) \
--bench benchmark \
--bench benchmark_rank_select \
--bench simd_rank_select_bench \
--bench dictionary_optimization_bench \
--bench cache_bench \
--bench avx512_bench \
--bench secure_memory_pool_bench \
--bench specialized_containers_bench \
--bench rank_select_bench \
--bench sortable_str_vec_bench \
--bench fsa_infrastructure_bench \
--bench memory_performance \
--bench memory_pools_bench \
--bench adaptive_mmap_bench \
--bench simple_benchmark \
--bench sortable_str_vec_optimized \
--bench valvec32_performance_bench \
--bench entropy_bench \
--bench dict_zip_bench
@echo "✅ All nightly benchmarks completed"
# Run SIMD Base64 tests specifically
test_simd_base64:
@echo "🧪 Running SIMD Base64 comprehensive tests..."
$(CARGO) test --release $(STABLE_FEATURES) --test simd_base64_tests -- --nocapture
@echo "✅ SIMD Base64 tests completed"
# Run SIMD Base64 tests with nightly features
test_simd_base64_nightly:
@echo "🌙 Running SIMD Base64 tests with nightly features..."
$(CARGO_NIGHTLY) test --release $(NIGHTLY_FEATURES) --test simd_base64_tests -- --nocapture
@echo "✅ SIMD Base64 nightly tests completed"
# Run enhanced safety tests
safety_tests:
@echo "🛡️ Running enhanced container safety tests..."
$(CARGO) test container_safety_tests $(STABLE_FEATURES) -- --nocapture
$(CARGO) test enhanced_memory_safety $(STABLE_FEATURES) -- --nocapture
@echo "✅ Safety tests completed"
# Run Miri memory safety tests
miri_tests:
@echo "🔍 Running Miri memory safety tests..."
@if command -v rustup >/dev/null 2>&1; then \
if ! rustup toolchain list | grep -q nightly; then \
echo "📦 Installing nightly toolchain..."; \
rustup install nightly; \
fi; \
if ! rustup component list --toolchain nightly | grep -q "miri.*installed"; then \
echo "📦 Installing Miri..."; \
rustup +nightly component add miri; \
fi; \
echo "🔬 Running enhanced memory safety tests with Miri..."; \
$(CARGO_MIRI) test enhanced_memory_safety --quiet || \
$(CARGO_MIRI) test enhanced_memory_safety --verbose; \
echo "✅ Miri tests completed"; \
else \
echo "❌ Error: rustup not found. Please install rustup first."; \
exit 1; \
fi
# Run full Miri test suite using the script
miri_full:
@echo "🔍 Running full Miri test suite..."
@if [ -x "./run_miri_tests.sh" ]; then \
./run_miri_tests.sh full; \
else \
echo "❌ Error: run_miri_tests.sh not found or not executable"; \
exit 1; \
fi
# =============================================================================
# CODE QUALITY TARGETS
# =============================================================================
# Format code
format:
@echo "🎨 Formatting code..."
$(CARGO) fmt --all
@echo "✅ Code formatting completed"
# Run clippy lints
clippy:
@echo "📎 Running clippy lints..."
$(CARGO) clippy $(STABLE_FEATURES) --all-targets -- -D warnings
@echo "✅ Clippy lints completed"
# Run clippy with nightly features
clippy_nightly:
@echo "🌙 Running clippy lints with nightly features..."
$(CARGO_NIGHTLY) clippy $(NIGHTLY_FEATURES) --all-targets -- -D warnings
@echo "✅ Clippy lints (nightly) completed"
# Generate documentation
doc:
@echo "📚 Generating documentation..."
$(CARGO) doc $(STABLE_FEATURES) --no-deps --open
@echo "✅ Documentation generated"
# Generate documentation with nightly features
doc_nightly:
@echo "🌙 Generating documentation with nightly features..."
$(CARGO_NIGHTLY) doc $(NIGHTLY_FEATURES) --no-deps --open
@echo "✅ Documentation (nightly) generated"
# =============================================================================
# COMPREHENSIVE TARGETS
# =============================================================================
# Full development cycle (stable)
dev: format clippy build test safety_tests
@echo "🚀 Full development cycle completed (stable features)"
# Full development cycle (nightly)
dev_nightly: format clippy_nightly build_nightly test_nightly miri_tests
@echo "🚀 Full development cycle completed (nightly features)"
# Complete validation (everything)
validate: dev dev_nightly doc doc_nightly
@echo "🎯 Complete validation completed"
# =============================================================================
# MAINTENANCE TARGETS
# =============================================================================
# Clean build artifacts
clean:
@echo "🧹 Cleaning build artifacts..."
$(CARGO) clean
@echo "🧹 Cleaning benchmark result files..."
@rm -f bench_results.txt benchmark_output.txt benchmark_results.txt
@rm -f benchmark_summary.txt final_bench_results.txt cpp_impl_bench_results.txt
@rm -f *_bench_results.txt *_benchmark_*.txt
@echo "🧹 Cleaning criterion reports..."
@rm -rf target/criterion
@echo "✅ Clean completed"
# Update dependencies
update:
@echo "📦 Updating dependencies..."
$(CARGO) update
@echo "✅ Dependencies updated"
# Check for outdated dependencies
outdated:
@echo "📋 Checking for outdated dependencies..."
@if command -v cargo-outdated >/dev/null 2>&1; then \
$(CARGO) outdated; \
else \
echo "💡 Install cargo-outdated: cargo install cargo-outdated"; \
fi
# Security audit
audit:
@echo "🔒 Running security audit..."
@if command -v cargo-audit >/dev/null 2>&1; then \
$(CARGO) audit; \
else \
echo "💡 Install cargo-audit: cargo install cargo-audit"; \
fi
# =============================================================================
# CI/CD TARGETS
# =============================================================================
# CI pipeline (stable features only)
ci: format clippy build test safety_tests
@echo "🤖 CI pipeline completed (stable)"
# CI pipeline (nightly features)
ci_nightly: format clippy_nightly build_nightly test_nightly miri_tests
@echo "🤖 CI pipeline completed (nightly)"
# Pre-commit hook
pre_commit: format clippy test_debug safety_tests
@echo "✅ Pre-commit checks completed"
# Release preparation
release_prep: clean format clippy build_release test_release bench doc audit
@echo "🚀 Release preparation completed"
# pre-commit sanity check
# Tests 2 feature combinations in debug+release:
# 1. Default features (simd, mmap, zstd, serde, lz4, async)
# 2. Nightly (default + avx512)
# Performance tests run only in release mode.
sanity: sanity_stable sanity_nightly
@echo ""
@echo "=== Sanity check complete ==="
@echo " 1. Stable (default features): debug + release"
@echo " 2. Nightly (default + avx512): debug + release"
# 1. Stable (default features)
sanity_stable:
@echo "=== [1/2] Stable (debug) ==="
$(CARGO) build $(STABLE_FEATURES)
$(CARGO) test --lib $(STABLE_FEATURES)
@echo "=== [1/2] Stable (release + perf) ==="
$(CARGO) build --release $(STABLE_FEATURES)
$(CARGO) test --release --lib $(STABLE_FEATURES)
@echo "[1/2] Stable: PASS"
# 2. Nightly (default + avx512)
sanity_nightly:
@echo "=== [2/2] Nightly (debug) ==="
$(CARGO_NIGHTLY) build $(NIGHTLY_FEATURES)
$(CARGO_NIGHTLY) test --lib $(NIGHTLY_FEATURES)
@echo "=== [2/2] Nightly (release + perf) ==="
$(CARGO_NIGHTLY) build --release $(NIGHTLY_FEATURES)
$(CARGO_NIGHTLY) test --release --lib $(NIGHTLY_FEATURES)
@echo "[2/2] Nightly: PASS"
# =============================================================================
# HELP TARGET
# =============================================================================
help:
@echo "Zipora Project Makefile"
@echo "======================="
@echo ""
@echo "Main Targets:"
@echo " all Build and test everything (stable features)"
@echo " build Build debug + release (stable features)"
@echo " test Test debug + release (stable features)"
@echo " build_nightly Build debug + release (all features including nightly)"
@echo " test_nightly Test debug + release (all features including nightly)"
@echo ""
@echo "Individual Build Targets:"
@echo " build_debug Build debug mode (stable features)"
@echo " build_release Build release mode (stable features)"
@echo " build_nightly_debug Build debug mode (nightly features)"
@echo " build_nightly_release Build release mode (nightly features)"
@echo ""
@echo "Individual Test Targets:"
@echo " test_debug Test debug mode (stable, no benchmarks)"
@echo " test_release Test release mode (stable, with stable benchmarks)"
@echo " test_nightly_debug Test debug mode (nightly, no benchmarks)"
@echo " test_nightly_release Test release mode (nightly, with all benchmarks including avx512)"
@echo ""
@echo "Specialized Targets:"
@echo " bench Run benchmarks"
@echo " bench_fsa Run FSA infrastructure benchmarks specifically"
@echo " bench_serialization Run I/O & Memory benchmarks specifically"
@echo " bench_io Run I/O & Memory performance tests specifically"
@echo " bench_release Run all benchmarks in release mode"
@echo " bench_nightly Run nightly benchmarks with AVX-512"
@echo " bench_all Run all available benchmarks explicitly (stable)"
@echo " bench_all_nightly Run all available benchmarks with nightly features"
@echo " test_simd_base64 Run SIMD Base64 comprehensive tests (stable)"
@echo " test_simd_base64_nightly Run SIMD Base64 tests with nightly features"
@echo " safety_tests Run enhanced container safety tests"
@echo " miri_tests Run Miri memory safety tests"
@echo " miri_full Run full Miri test suite (using script)"
@echo ""
@echo "Code Quality:"
@echo " format Format code with rustfmt"
@echo " clippy Run clippy lints (stable)"
@echo " clippy_nightly Run clippy lints (nightly)"
@echo " doc Generate documentation (stable)"
@echo " doc_nightly Generate documentation (nightly)"
@echo ""
@echo "Development Workflows:"
@echo " dev Full development cycle (stable)"
@echo " dev_nightly Full development cycle (nightly)"
@echo " validate Complete validation (everything)"
@echo ""
@echo "Maintenance:"
@echo " clean Clean build artifacts"
@echo " update Update dependencies"
@echo " outdated Check outdated dependencies"
@echo " audit Security audit"
@echo ""
@echo "CI/CD:"
@echo " ci CI pipeline (stable)"
@echo " ci_nightly CI pipeline (nightly)"
@echo " pre_commit Pre-commit checks"
@echo " release_prep Release preparation"
@echo " sanity Full sanity check (4 feature combos x debug+release)"
@echo ""
@echo "Features:"
@echo " Default: simd, mmap, zstd, serde, lz4, async"
@echo " Optional: ffi"
@echo " Nightly: avx512"