-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
586 lines (519 loc) · 23.8 KB
/
Makefile
File metadata and controls
586 lines (519 loc) · 23.8 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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# =============================================================================
# Project Makefile
# =============================================================================
# Project: zoneinfo
# Purpose: Hexagonal architecture library with port/adapter pattern
#
# This Makefile provides:
# - Build targets (build, clean, rebuild)
# - Test infrastructure (test, test-coverage)
# - Format/check targets (format, stats)
# - Documentation generation (docs, api-docs)
# - Development tools (setup-hooks, ci)
# =============================================================================
PROJECT_NAME := zoneinfo
.PHONY: all build build-dev build-opt build-release build-tests build-profiles check check-arch \
clean clean-clutter clean-coverage clean-deep compress deps \
help prereqs rebuild refresh stats test test-all test-coverage test-framework \
test-integration test-unit test-python test-windows test-examples install-tools build-coverage-runtime \
submodule-init submodule-update submodule-status spark-check spark-prove \
build-examples examples run-examples
# FIX: ENABLE AFTER THE TARGETS CONVERT TO USING OUR ADAFMT TOOL, WHICH IS IN DEVELOPMENT.
# format format-all format-src format-tests
# =============================================================================
# OS Detection
# =============================================================================
UNAME := $(shell uname -s)
# =============================================================================
# Colors for Output
# =============================================================================
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
BLUE := \033[0;34m
ORANGE := \033[38;5;208m
CYAN := \033[0;36m
BOLD := \033[1m
NC := \033[0m
# =============================================================================
# Tool Paths
# =============================================================================
ALR := alr
GPRBUILD := gprbuild
GNATFORMAT := gnatformat
GNATDOC := gnatdoc
PYTHON3 := python3
# =============================================================================
# Tool Flags
# =============================================================================
# NOTE: --no-indirect-imports is NOT needed. Architecture is enforced via
# Stand-Alone Library with explicit Library_Interface in zoneinfo.gpr
# which prevents transitive access from API layer to internal packages.
# Filter: show only warnings/style/errors, suppress ranlib "no symbols" noise
BUILD_FILTER := 2>&1 | grep -v 'has no symbols' | grep -E 'warning:|\(style\)|error:' || true
ALR_BUILD_FLAGS := -j8
ALR_TEST_FLAGS := -j8
# =============================================================================
# Directories
# =============================================================================
BUILD_DIR := obj
LIB_DIR := lib
DOCS_DIR := docs/api
COVERAGE_DIR := coverage
# Get the directory of the currently executing Makefile.
# This assumes the Makefile is the last one in the list.
MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(MAKEFILE_DIR)/$(PROJECT_NAME)
TEST_DIR := test
# Directories to format (library layers + tests)
FORMAT_DIRS := \
$(wildcard src/api) \
$(wildcard src/application) \
$(wildcard src/domain) \
$(wildcard src/infrastructure) \
$(wildcard $(TEST_DIR))
# =============================================================================
# Default Target
# =============================================================================
all: build
# =============================================================================
# Help Target
# =============================================================================
help: ## Display this help message
@echo "$(CYAN)$(BOLD)╔══════════════════════════════════════════════════╗$(NC)"
@echo "$(CYAN)$(BOLD)║ Zoneinfo - Timezone Library for Ada 2022 ║$(NC)"
@echo "$(CYAN)$(BOLD)╚══════════════════════════════════════════════════╝$(NC)"
@echo " "
@echo "$(YELLOW)Build Commands:$(NC)"
@echo " build - Build library (development mode)"
@echo " build-dev - Build with development flags"
@echo " build-opt - Build with optimization (-O2)"
@echo " build-release - Build in release mode"
@echo " build-tests - Build all test executables"
@echo " clean - Clean build artifacts"
@echo " clean-clutter - Remove temporary files and backups"
@echo " clean-coverage - Clean coverage data"
@echo " clean-deep - Deep clean (includes Alire cache)"
@echo " compress - Create compressed source archive (tgz)"
@echo " rebuild - Clean and rebuild"
@echo ""
@echo "$(YELLOW)Testing Commands:$(NC)"
@echo " test - Run comprehensive test suite (main runner)"
@echo " test-unit - Run unit tests only"
@echo " test-integration - Run integration tests only"
@echo " test-all - Run all test executables"
@echo " test-framework - Run all test suites (unit + integration)"
@echo " test-python - Run Python script tests (arch_guard.py validation)"
@echo " test-examples - Run Ada-based tests for all examples"
@echo " test-coverage - Run tests with coverage analysis"
@echo " test-windows - Trigger Windows CI validation on GitHub"
@echo ""
@echo "$(YELLOW)Examples Commands:$(NC)"
@echo " build-examples - Build all example programs"
@echo " examples - Alias for build-examples"
@echo " run-examples - Build and run all example programs"
@echo ""
@echo "$(YELLOW)Quality & Architecture Commands:$(NC)"
@echo " check - Run static analysis"
@echo " check-arch - Validate hexagonal architecture boundaries"
@echo " spark-check - Run SPARK formal verification on domain/application"
@echo " spark-prove - Run SPARK PROVE formal verification"
# FIX: ENABLE AFTER THE TARGETS CONVERT TO USING OUR ADAFMT TOOL, WHICH IS IN DEVELOPMENT.
# @echo " format-src - Auto-format source code only"
# @echo " format-tests - Auto-format test code only"
# @echo " format-all - Auto-format all code"
# @echo " format - Alias for format-all"
@echo " stats - Display project statistics by layer"
@echo ""
@echo "$(YELLOW)Utility Commands:$(NC)"
@echo " deps - Show dependency information"
@echo " prereqs - Verify prerequisites are satisfied"
@echo " refresh - Refresh Alire dependencies"
@echo " install-tools - Install development tools (GMP, gcovr, gnatformat)"
@echo " build-coverage-runtime - Build GNATcoverage runtime library"
@echo ""
@echo "$(YELLOW)Advanced Commands:$(NC)"
@echo " build-profiles - Test compilation with all build profiles"
@echo ""
@echo "$(YELLOW)Profile Selection (Target Platform):$(NC)"
@echo " Build with specific profile using ZONEINFO_PROFILE variable:"
@echo " alr build # standard (default)"
@echo " alr build -- -XZONEINFO_PROFILE=embedded # Ravenscar embedded"
@echo " alr build -- -XZONEINFO_PROFILE=baremetal # Zero footprint"
@echo " alr build -- -XZONEINFO_PROFILE=concurrent # Multi-threaded"
@echo " alr build -- -XZONEINFO_PROFILE=stm32h7s78"
@echo " alr build -- -XZONEINFO_PROFILE=stm32mp135_linux"
@echo ""
@echo "$(YELLOW)Workflow Shortcuts:$(NC)"
@echo " all - Build library (default)"
@echo ""
@echo "$(YELLOW)Submodule Commands:$(NC)"
@echo " submodule-init - Initialize submodules after fresh clone"
@echo " submodule-update - Pull latest from all submodule repos"
@echo " submodule-status - Show submodule commit status"
# =============================================================================
# Build Commands
# =============================================================================
prereqs:
@echo "$(GREEN)✓ All prerequisites satisfied$(NC)"
build: build-dev
build-dev: check-arch prereqs
@echo "$(GREEN)Building $(PROJECT_NAME) (development mode)...$(NC)"
@$(ALR) build --development -- $(ALR_BUILD_FLAGS) $(BUILD_FILTER)
@echo "$(GREEN)✓ Development build complete: $(LIB_DIR)/lib$(PROJECT_NAME).a$(NC)"
build-opt: check-arch prereqs
@echo "$(GREEN)Building $(PROJECT_NAME) (optimized -O2)...$(NC)"
@$(ALR) build -- -O2 $(ALR_BUILD_FLAGS) $(BUILD_FILTER)
@echo "$(GREEN)✓ Optimized build complete$(NC)"
build-release: check-arch prereqs
@echo "$(GREEN)Building $(PROJECT_NAME) (release mode)...$(NC)"
@$(ALR) build --release -- $(ALR_BUILD_FLAGS) $(BUILD_FILTER)
@echo "$(GREEN)✓ Release build complete: $(LIB_DIR)/lib$(PROJECT_NAME).a$(NC)"
build-tests: check-arch prereqs
@echo "$(GREEN)Building test suites...$(NC)"
@if [ -f "$(TEST_DIR)/unit/unit_tests.gpr" ]; then \
$(ALR) exec -- $(GPRBUILD) -P $(TEST_DIR)/unit/unit_tests.gpr -p $(ALR_TEST_FLAGS) $(BUILD_FILTER); \
echo "$(GREEN)✓ Unit tests built$(NC)"; \
else \
echo "$(YELLOW)Unit test project not found$(NC)"; \
fi
@if [ -f "$(TEST_DIR)/integration/integration_tests.gpr" ]; then \
$(ALR) exec -- $(GPRBUILD) -P $(TEST_DIR)/integration/integration_tests.gpr -p $(ALR_TEST_FLAGS) $(BUILD_FILTER); \
echo "$(GREEN)✓ Integration tests built$(NC)"; \
else \
echo "$(YELLOW)Integration test project not found$(NC)"; \
fi
build-profiles: ## Validate library builds with all configuration profiles
@echo "$(CYAN)$(BOLD)Testing library compilation with all profiles...$(NC)"
@echo "$(CYAN)Note: This validates compilation only (not cross-compilation)$(NC)"
@echo "$(CYAN)Uses: alr build -- -XZONEINFO_PROFILE=<profile>$(NC)"
@echo ""
@PROFILES="standard embedded baremetal concurrent stm32h7s78 stm32mp135_linux"; \
FAILED=0; \
for profile in $$PROFILES; do \
echo "$(YELLOW)Testing profile: $$profile$(NC)"; \
if [ -f "config/profiles/$$profile/$(PROJECT_NAME)_config.ads" ]; then \
$(ALR) clean > /dev/null 2>&1; \
if $(ALR) build --development -- -XZONEINFO_PROFILE=$$profile -j8 2>&1 | grep -E 'error:|failed' > /dev/null; then \
echo "$(RED)✗ Profile $$profile: FAILED$(NC)"; \
FAILED=$$((FAILED + 1)); \
else \
echo "$(GREEN)✓ Profile $$profile: OK$(NC)"; \
fi; \
else \
echo "$(YELLOW)⚠ Profile $$profile: config file not found (skipping)$(NC)"; \
fi; \
echo ""; \
done; \
$(ALR) clean > /dev/null 2>&1; \
if [ $$FAILED -eq 0 ]; then \
echo "$(GREEN)$(BOLD)✓ All available profiles compiled successfully$(NC)"; \
else \
echo "$(RED)$(BOLD)✗ $$FAILED profile(s) failed$(NC)"; \
exit 1; \
fi
clean:
@echo "$(YELLOW)Cleaning project build artifacts (keeps dependencies)...$(NC)"
@# Use gprclean WITHOUT -r to clean only our project, not dependencies
@$(ALR) exec -- gprclean -P $(PROJECT_NAME).gpr -q 2>/dev/null || true
@$(ALR) exec -- gprclean -P $(TEST_DIR)/unit/unit_tests.gpr -q 2>/dev/null || true
@$(ALR) exec -- gprclean -P $(TEST_DIR)/integration/integration_tests.gpr -q 2>/dev/null || true
@rm -rf $(BUILD_DIR) $(LIB_DIR) $(TEST_DIR)/bin $(TEST_DIR)/obj
@find . -name "*.backup" -delete 2>/dev/null || true
@echo "$(GREEN)✓ Project artifacts cleaned (dependencies preserved for fast rebuild)$(NC)"
clean-deep:
@echo "$(YELLOW)Deep cleaning ALL artifacts including dependencies...$(NC)"
@echo "$(YELLOW)⚠️ This will require rebuilding GNATCOLL, XMLAda, etc. (slow!)$(NC)"
@$(ALR) clean
@rm -rf $(BUILD_DIR) $(LIB_DIR) $(TEST_DIR)/bin $(TEST_DIR)/obj
@find . -name "*.backup" -delete 2>/dev/null || true
@echo "$(GREEN)✓ Deep clean complete (next build will be slow)$(NC)"
clean-coverage:
@echo "$(YELLOW)Cleaning coverage artifacts...$(NC)"
@find . -name "*.srctrace" -delete 2>/dev/null || true
@find . -name "*.traces" -delete 2>/dev/null || true
@find . -name "*.sid" -delete 2>/dev/null || true
@rm -rf coverage/ 2>/dev/null || true
@rm -rf gnatcov-instr/ 2>/dev/null || true
@echo "$(GREEN)✓ Coverage artifacts cleaned$(NC)"
clean-clutter: ## Remove temporary files, backups, and clutter
@echo "$(CYAN)Cleaning temporary files and clutter...$(NC)"
@$(PYTHON3) scripts/python/shared/makefile/cleanup_temp_files.py
@echo "$(GREEN)✓ Temporary files removed$(NC)"
compress:
@echo "$(CYAN)Creating compressed source archive...$(NC)"
git archive --format=tar.gz -o "$(PROJECT_NAME).tar.gz" HEAD
@echo "$(GREEN)✓ Archive created: $(PROJECT_NAME).tar.gz$(NC)"
rebuild: clean build
# =============================================================================
# Testing Commands
# =============================================================================
test: test-all
test-all: build build-tests
@echo "$(GREEN)Running all test executables...$(NC)"
@failed=0; \
if [ -d "$(TEST_DIR)/bin" ]; then \
for test in $(TEST_DIR)/bin/*_runner; do \
if [ -x "$$test" ] && [ -f "$$test" ]; then \
echo "$(CYAN)Running $$test...$(NC)"; \
$$test || failed=1; \
echo ""; \
fi; \
done; \
else \
echo "$(YELLOW)No test executables found in $(TEST_DIR)/bin$(NC)"; \
fi; \
if [ $$failed -eq 0 ]; then \
echo ""; \
echo "\033[1;92m########################################"; \
echo "### ###"; \
echo "### ALL TEST SUITES: SUCCESS ###"; \
echo "### All tests passed! ###"; \
echo "### ###"; \
echo "########################################\033[0m"; \
echo ""; \
else \
echo ""; \
echo "\033[1;91m########################################"; \
echo "### ###"; \
echo "### ALL TEST SUITES: FAILURE ###"; \
echo "### Some tests failed! ###"; \
echo "### ###"; \
echo "########################################\033[0m"; \
echo ""; \
exit 1; \
fi
test-unit: build build-tests
@echo "$(GREEN)Running unit tests...$(NC)"
@if [ -f "$(TEST_DIR)/bin/unit_runner" ]; then \
$(TEST_DIR)/bin/unit_runner; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ Unit tests passed$(NC)"; \
else \
echo "$(RED)✗ Unit tests failed$(NC)"; \
exit 1; \
fi; \
else \
echo "$(YELLOW)Unit test runner not found at $(TEST_DIR)/bin/unit_runner$(NC)"; \
exit 1; \
fi
test-integration: build build-tests
@echo "$(GREEN)Running integration tests...$(NC)"
@if [ -f "$(TEST_DIR)/bin/integration_runner" ]; then \
$(TEST_DIR)/bin/integration_runner; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ Integration tests passed$(NC)"; \
else \
echo "$(RED)✗ Integration tests failed$(NC)"; \
exit 1; \
fi; \
else \
echo "$(YELLOW)Integration test runner not found at $(TEST_DIR)/bin/integration_runner$(NC)"; \
exit 1; \
fi
test-framework: test-unit test-integration ## Run all test suites
@echo "$(GREEN)$(BOLD)✓ All test suites completed$(NC)"
test-coverage: ## Run tests with GNATcoverage analysis
@echo "$(GREEN)Running tests with GNATcoverage analysis...$(NC)"
@$(PYTHON3) scripts/python/shared/makefile/coverage_ada.py
# =============================================================================
# Quality & Code Formatting Commands
# =============================================================================
check:
@echo "$(GREEN)Running code checks...$(NC)"
@$(ALR) build --development -- $(ALR_BUILD_FLAGS)
@echo "$(GREEN)✓ Code checks complete$(NC)"
check-arch: ## Validate hexagonal architecture boundaries
@echo "$(GREEN)Validating architecture boundaries...$(NC)"
@PYTHONPATH=scripts/python/shared $(PYTHON3) -m arch_guard --project-root .
@if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ Architecture validation passed$(NC)"; \
else \
echo "$(RED)✗ Architecture validation failed$(NC)"; \
exit 1; \
fi
spark-check: ## Run SPARK formal verification on domain/application layers
@echo "$(GREEN)Running SPARK verification...$(NC)"
@if [ ! -f "$(PROJECT_NAME)_spark.gpr" ]; then \
echo "$(RED)✗ SPARK project file not found: $(PROJECT_NAME)_spark.gpr$(NC)"; \
exit 1; \
fi
@cd $(TEST_DIR) && $(ALR) exec -- gnatprove -j12 -P ../$(PROJECT_NAME)_spark.gpr --mode=check 2>&1; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ SPARK verification passed$(NC)"; \
else \
echo "$(RED)✗ SPARK verification failed$(NC)"; \
exit 1; \
fi
spark-prove: ## Run SPARK PROVE formal verification
@echo "$(GREEN)Running SPARK PROVE verification...$(NC)"
@if [ ! -f "$(PROJECT_NAME)_spark.gpr" ]; then \
echo "$(RED)✗ SPARK project file not found: $(PROJECT_NAME)_spark.gpr$(NC)"; \
exit 1; \
fi
@cd $(TEST_DIR) && $(ALR) exec -- gnatprove -j0 -P ../$(PROJECT_NAME)_spark.gpr --mode=prove --level=2 2>&1; \
if [ $$? -eq 0 ]; then \
echo "$(GREEN)✓ SPARK PROVE verification passed$(NC)"; \
else \
echo "$(RED)✗ SPARK PROVE verification failed$(NC)"; \
exit 1; \
fi
test-python: ## Run Python script tests (arch_guard.py validation)
@echo "$(GREEN)Running Python script tests...$(NC)"
@cd test/scripts/python/shared && $(PYTHON3) -m pytest -v
@echo "$(GREEN)✓ Python tests complete$(NC)"
test-windows: ## Trigger Windows CI validation on GitHub Actions
@echo "$(CYAN)Triggering Windows CI validation...$(NC)"
@if [ ! -f ".github/workflows/windows-release.yml" ]; then \
echo "$(RED)✗ Windows workflow not found$(NC)"; \
exit 1; \
fi
@if ! command -v gh >/dev/null 2>&1; then \
echo "$(RED)✗ GitHub CLI (gh) not installed$(NC)"; \
echo " Install from: https://cli.github.com/"; \
exit 1; \
fi
@REF=$$(git rev-parse HEAD); \
echo "$(CYAN) Ref: $${REF:0:8}$(NC)"; \
gh workflow run windows-release.yml -f version=dev -f ref=$$REF; \
echo "$(GREEN)✓ Workflow triggered$(NC)"; \
echo ""; \
echo "$(YELLOW)Waiting for workflow to start...$(NC)"; \
sleep 5; \
RUN_ID=$$(gh run list --workflow=windows-release.yml --limit=1 --json databaseId -q '.[0].databaseId'); \
if [ -n "$$RUN_ID" ]; then \
echo "$(CYAN) Run ID: $$RUN_ID$(NC)"; \
echo "$(YELLOW)Watching workflow (Ctrl+C to detach)...$(NC)"; \
gh run watch $$RUN_ID --exit-status && \
echo "$(GREEN)$(BOLD)✓ Windows validation passed$(NC)" || \
(echo "$(RED)$(BOLD)✗ Windows validation failed$(NC)" && exit 1); \
else \
echo "$(RED)✗ Could not find workflow run$(NC)"; \
exit 1; \
fi
# =============================================================================
# Examples Commands
# =============================================================================
build-examples: build check-arch prereqs
@echo "$(GREEN)Building example programs...$(NC)"
@if [ -f "examples/examples.gpr" ]; then \
$(ALR) exec -- $(GPRBUILD) -P examples/examples.gpr -p $(ALR_BUILD_FLAGS) $(BUILD_FILTER); \
echo "$(GREEN)✓ Examples built$(NC)"; \
else \
echo "$(YELLOW)Examples project not found$(NC)"; \
fi
examples: build-examples
run-examples: build-examples
@echo "$(GREEN)Running example programs...$(NC)"
@if [ -d "examples/bin" ]; then \
for example in examples/bin/*; do \
if [ -x "$$example" ] && [ -f "$$example" ]; then \
echo "$(CYAN)Running $$example...$(NC)"; \
$$example || true; \
echo ""; \
fi; \
done; \
echo "$(GREEN)✓ All examples completed$(NC)"; \
else \
echo "$(YELLOW)No examples found in examples/bin$(NC)"; \
fi
test-examples: build-examples
@echo "$(GREEN)Running examples tests...$(NC)"
@failed=0; \
if [ -d "examples/bin" ]; then \
for example in examples/bin/*; do \
if [ -x "$$example" ] && [ -f "$$example" ]; then \
name=$$(basename "$$example"); \
echo "$(CYAN)Testing $$name...$(NC)"; \
if $$example > /dev/null 2>&1; then \
echo " $(GREEN)✓ $$name passed$(NC)"; \
else \
echo " $(RED)✗ $$name failed$(NC)"; \
failed=1; \
fi; \
fi; \
done; \
if [ $$failed -eq 0 ]; then \
echo "$(GREEN)✓ All examples tests passed$(NC)"; \
else \
echo "$(RED)✗ Some examples tests failed$(NC)"; \
exit 1; \
fi; \
else \
echo "$(YELLOW)No examples found in examples/bin$(NC)"; \
exit 1; \
fi
# FIXME: REPLACE WITH THE ADAFMT TOOL WE ARE CREATING WHEN IT IS COMPLETED.
# THE CURRENT SCRIPT IS COMMENTING COMMENTS AND MESSING UP WITH INDEXED COMMENTS.
# format-src:
# @echo "$(GREEN)Formatting source code...$(NC)"
# ...
# format-tests:
# @echo "$(GREEN)Formatting test code...$(NC)"
# ...
# format-all: format-src format-tests
# @echo "$(GREEN)✓ All code formatting complete$(NC)"
# format: format-all
# =============================================================================
# Development Commands
# =============================================================================
stats:
@echo "$(CYAN)$(BOLD)Project Statistics for $(PROJECT_NAME)$(NC)"
@echo "$(YELLOW)════════════════════════════════════════$(NC)"
@echo ""
@echo "Ada Source Files by Layer:"
@echo " Domain specs: $$(find src/domain -name "*.ads" 2>/dev/null | wc -l | tr -d ' ')"
@echo " Domain bodies: $$(find src/domain -name "*.adb" 2>/dev/null | wc -l | tr -d ' ')"
@echo " Application specs: $$(find src/application -name "*.ads" 2>/dev/null | wc -l | tr -d ' ')"
@echo " Application bodies: $$(find src/application -name "*.adb" 2>/dev/null | wc -l | tr -d ' ')"
@echo " Infrastructure specs: $$(find src/infrastructure -name "*.ads" 2>/dev/null | wc -l | tr -d ' ')"
@echo " Infrastructure bodies: $$(find src/infrastructure -name "*.adb" 2>/dev/null | wc -l | tr -d ' ')"
@echo " API specs: $$(find src/api -name "*.ads" 2>/dev/null | wc -l | tr -d ' ')"
@echo " API bodies: $$(find src/api -name "*.adb" 2>/dev/null | wc -l | tr -d ' ')"
@echo ""
@echo "Lines of Code:"
@find src/api src/application src/domain src/infrastructure -name "*.ads" -o -name "*.adb" 2>/dev/null | \
xargs wc -l 2>/dev/null | tail -1 | awk '{printf " Total: %d lines\n", $$1}' || echo " Total: 0 lines"
@echo ""
@echo "Build Artifacts:"
@if [ -f "./lib/lib$(PROJECT_NAME).a" ]; then \
echo " Library: $$(ls -lh ./lib/lib$(PROJECT_NAME).a 2>/dev/null | awk '{print $$5}')"; \
else \
echo " No library found (run 'make build')"; \
fi
# =============================================================================
# Advanced Targets
# =============================================================================
deps: ## Display project dependencies
@echo "$(CYAN)Project dependencies from alire.toml:$(NC)"
@grep -A 10 "\[\[depends-on\]\]" alire.toml || echo "$(YELLOW)No dependencies found$(NC)"
@echo ""
@echo "$(CYAN)Alire dependency tree:$(NC)"
@$(ALR) show --solve || echo "$(YELLOW)Could not resolve dependencies$(NC)"
refresh: ## Refresh Alire dependencies
@echo "$(CYAN)Refreshing Alire dependencies...$(NC)"
@$(ALR) update
@echo "$(GREEN)✓ Dependencies refreshed$(NC)"
install-tools: ## Install development tools (GMP, gcovr, gnatformat)
@echo "$(CYAN)Installing development tools...$(NC)"
@$(PYTHON3) scripts/python/shared/makefile/install_tools.py
@echo "$(GREEN)✓ Tool installation complete$(NC)"
build-coverage-runtime: ## Force rebuild GNATcoverage runtime library
@echo "$(CYAN)Rebuilding GNATcoverage runtime...$(NC)"
@$(PYTHON3) scripts/python/shared/makefile/coverage_ada.py --rebuild-runtime --unit-only
@echo "$(GREEN)✓ GNATcov runtime rebuilt (run 'make test-coverage' for full analysis)$(NC)"
.DEFAULT_GOAL := help
## ---------------------------------------------------------------------------
## Submodule Management
## ---------------------------------------------------------------------------
submodule-init: ## Initialize submodules after fresh clone
git submodule update --init --recursive
submodule-update: ## Pull latest from all submodule repos
git submodule update --remote --merge
@echo ""
@echo "Submodules updated. Review changes, then run:"
@echo " git add docs scripts/python test/scripts/python/shared"
@echo " git commit -m 'chore: update submodules'"
@echo " git push"
submodule-status: ## Show submodule commit status
git submodule status