-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (91 loc) · 4.04 KB
/
Makefile
File metadata and controls
123 lines (91 loc) · 4.04 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
# Scrollcast - Development Makefile
.PHONY: help build test clean install lint fmt check release example docs all
# Default target
help: ## Show this help message
@echo "Scrollcast - Development Commands"
@echo "================================="
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Build targets
build: ## Build the project in debug mode
cargo build
release: ## Build the project in release mode
cargo build --release
install: ## Install the binary locally
cargo install --path .
# Development targets
test: ## Run all tests
cargo test
check: ## Check code without building
cargo check
lint: ## Run clippy for linting
cargo clippy -- -D warnings
fmt: ## Format code using rustfmt
cargo fmt
fmt-check: ## Check if code is formatted correctly
cargo fmt -- --check
# Quality assurance
all-checks: fmt-check lint test ## Run all quality checks
# Clean targets
clean: ## Clean build artifacts
cargo clean
rm -rf output/
rm -rf target/
# Example runs
example-pdf: build ## Generate example PDF from test project
./target/debug/scrollcast test-project/ -o output/example.pdf
example-epub: build ## Generate example EPUB from test project
./target/debug/scrollcast test-project/ -o output/example.epub -f epub
example-html: build ## Generate example HTML from test project
./target/debug/scrollcast test-project/ -o output/example.html -f html
example-markdown: build ## Generate example Markdown from test project
./target/debug/scrollcast test-project/ -o output/example.md -f markdown
example-all: example-pdf example-epub example-html example-markdown ## Generate all example formats
# Self-documentation
docs-pdf: release ## Generate PDF documentation of this project
./target/release/scrollcast . -o output/scrollcast-source.pdf
docs-epub: release ## Generate EPUB documentation of this project
./target/release/scrollcast . -o output/scrollcast-source.epub -f epub
docs-all: docs-pdf docs-epub ## Generate all documentation formats
# Development setup
setup: ## Set up development environment
@echo "Setting up development environment..."
@command -v pandoc >/dev/null 2>&1 || { echo >&2 "Pandoc is required but not installed. Please install it first."; exit 1; }
@command -v xelatex >/dev/null 2>&1 || { echo >&2 "XeLaTeX is required for PDF generation. Please install texlive-xetex."; exit 1; }
@echo "✅ Pandoc found: $$(pandoc --version | head -n1)"
@echo "✅ XeLaTeX found: $$(xelatex --version | head -n1)"
@echo "✅ Development environment is ready!"
# Benchmarking and performance
bench: ## Run performance benchmarks
cargo bench
# Release preparation
pre-release: all-checks example-all docs-all ## Prepare for release (run all checks and generate examples)
@echo "🚀 Pre-release checks completed successfully!"
@echo "📦 Built examples and documentation in output/"
# Utility targets
size: release ## Show binary size
@ls -lh target/release/scrollcast | awk '{print "Binary size: " $$5}'
list-themes: build ## List available syntax highlighting themes
./target/debug/scrollcast --list-themes
list-languages: build ## List supported programming languages
./target/debug/scrollcast --list-languages
# Output directory management
output-dir: ## Create output directory
mkdir -p output
# Development workflow
dev: fmt lint test ## Run development workflow (format, lint, test)
# Watch mode (requires cargo-watch)
watch: ## Watch for changes and run tests (requires: cargo install cargo-watch)
cargo watch -x test
watch-build: ## Watch for changes and build (requires: cargo install cargo-watch)
cargo watch -x build
# Package information
info: ## Show project information
@echo "Project: Scrollcast"
@echo "Version: $$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')"
@echo "Rust version: $$(rustc --version)"
@echo "Cargo version: $$(cargo --version)"
@echo "Target directory: target/"
@echo "Output directory: output/"
# Default target when no target is specified
all: build test ## Build and test the project