-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (80 loc) · 2.64 KB
/
Copy pathMakefile
File metadata and controls
92 lines (80 loc) · 2.64 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
.PHONY: all format lint check format-python format-shell clean help update-packages publish
# Default target
all: format lint
# Help target
help:
@echo "PKG Repository Makefile"
@echo ""
@echo "Available targets:"
@echo " make format - Format all code"
@echo " make lint - Lint all code"
@echo " make check - Format and lint (same as 'make')"
@echo " make clean - Remove build artifacts"
@echo " make update-packages - Update packages.json"
@echo " make publish - Update, commit and push"
@echo " make help - Show this help"
# Combined check
check: format lint
# Format everything
format: format-python format-shell
@echo "✓ Formatting complete"
# Lint everything
lint: lint-shell lint-packages
@echo "✓ Linting complete"
# Python formatting
format-python:
@echo "→ Formatting Python..."
@if command -v ruff >/dev/null 2>&1; then \
ruff format tools/ --quiet; \
else \
echo " ⚠ ruff not found, skipping Python formatting"; \
fi
# Shell script formatting
format-shell:
@echo "→ Formatting shell scripts..."
@if command -v shfmt >/dev/null 2>&1; then \
shfmt -w -i 2 -bn -ci tools/pkg.sh tools/lib/helpers.sh tools/check-isa-level.sh; \
find . -maxdepth 2 -type f -name "PKGBUILD" -exec shfmt -w -i 2 -bn -ci {} \; 2>/dev/null || true; \
else \
echo " ⚠ shfmt not found, skipping shell formatting"; \
fi
# Shell script linting
lint-shell:
@echo "→ Linting shell scripts..."
@if command -v shellcheck >/dev/null 2>&1; then \
shellcheck tools/pkg.sh tools/check-isa-level.sh tools/lib/helpers.sh || true; \
else \
echo " ⚠ shellcheck not found, skipping shell linting"; \
fi
# Package linting
lint-packages:
@echo "→ Linting packages with namcap..."
@if command -v namcap >/dev/null 2>&1; then \
find . -maxdepth 2 -type f -name "PKGBUILD" -exec namcap {} \; 2>/dev/null || true; \
else \
echo " ⚠ namcap not found, skipping package linting"; \
fi
# Update packages.json
update-packages:
@echo "→ Updating packages.json..."
@if [ -f tools/vp-dev.py ]; then \
./tools/vp-dev.py update; \
else \
echo " ✗ tools/vp-dev.py not found"; \
exit 1; \
fi
# Publish
publish:
@echo "→ Publishing repository..."
@if [ -f tools/vp-dev.py ]; then \
./tools/vp-dev.py publish; \
else \
echo " ✗ tools/vp-dev.py not found"; \
exit 1; \
fi
# Clean build artifacts
clean:
@echo "→ Cleaning build artifacts..."
@find . -maxdepth 2 \( -name "*.pkg.tar.zst" -o -name "*.pkg.tar.xz" -o -name "*.log" -o -name "*.bak" \) -delete
@find . -maxdepth 2 -type d \( -name "pkg" -o -name "src" \) -exec rm -rf {} + 2>/dev/null || true
@echo "✓ Cleaned"