-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (114 loc) · 4.2 KB
/
Makefile
File metadata and controls
142 lines (114 loc) · 4.2 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
# Azul Browse - Build Automation
# Usage: make <target>
.PHONY: all build release install uninstall test lint fmt check clean help version bump-patch bump-minor bump-major tag
# Configuration
BINARY_NAME := azul
INSTALL_PATH := /usr/local/bin
VERSION := $(shell grep '^version' Cargo.toml | head -1 | cut -d'"' -f2)
# Default target
all: build
# ============================================================================
# Development
# ============================================================================
## build: Build debug binary
build:
cargo build
## release: Build optimized release binary
release:
cargo build --release
## run: Run the application
run:
cargo run
## run-release: Run the release build
run-release:
cargo run --release
## test: Run all tests
test:
cargo test --all-features
## lint: Run clippy linter
lint:
cargo clippy --all-targets --all-features -- -D warnings
## fmt: Format code
fmt:
cargo fmt
## fmt-check: Check code formatting
fmt-check:
cargo fmt --all -- --check
## check: Run all checks (fmt, lint, test)
check: fmt-check lint test
@echo "✓ All checks passed!"
## clean: Clean build artifacts
clean:
cargo clean
# ============================================================================
# Installation
# ============================================================================
## install: Build and install to system (requires sudo)
install: release
@echo "Installing $(BINARY_NAME) to $(INSTALL_PATH)..."
sudo cp target/release/$(BINARY_NAME) $(INSTALL_PATH)/$(BINARY_NAME)
@echo "✓ Installed $(BINARY_NAME) v$(VERSION)"
## install-user: Install to ~/.local/bin (no sudo)
install-user: release
@mkdir -p ~/.local/bin
cp target/release/$(BINARY_NAME) ~/.local/bin/$(BINARY_NAME)
@echo "✓ Installed $(BINARY_NAME) v$(VERSION) to ~/.local/bin"
@echo " Make sure ~/.local/bin is in your PATH"
## uninstall: Remove from system
uninstall:
sudo rm -f $(INSTALL_PATH)/$(BINARY_NAME)
@echo "✓ Uninstalled $(BINARY_NAME)"
## cargo-install: Install via cargo
cargo-install:
cargo install --path .
# ============================================================================
# Versioning & Release
# ============================================================================
## version: Show current version
version:
@echo "$(VERSION)"
## bump-patch: Bump patch version (0.0.X -> 0.0.X+1)
bump-patch:
@NEW_VERSION=$$(echo $(VERSION) | awk -F. '{print $$1"."$$2"."$$3+1}'); \
sed -i 's/^version = "$(VERSION)"/version = "'$$NEW_VERSION'"/' Cargo.toml; \
echo "Bumped version: $(VERSION) -> $$NEW_VERSION"
## bump-minor: Bump minor version (0.X.0 -> 0.X+1.0)
bump-minor:
@NEW_VERSION=$$(echo $(VERSION) | awk -F. '{print $$1"."$$2+1".0"}'); \
sed -i 's/^version = "$(VERSION)"/version = "'$$NEW_VERSION'"/' Cargo.toml; \
echo "Bumped version: $(VERSION) -> $$NEW_VERSION"
## bump-major: Bump major version (X.0.0 -> X+1.0.0)
bump-major:
@NEW_VERSION=$$(echo $(VERSION) | awk -F. '{print $$1+1".0.0"}'); \
sed -i 's/^version = "$(VERSION)"/version = "'$$NEW_VERSION'"/' Cargo.toml; \
echo "Bumped version: $(VERSION) -> $$NEW_VERSION"
## tag: Create a git tag for current version
tag:
@echo "Creating tag v$(VERSION)..."
git tag -a "v$(VERSION)" -m "Release v$(VERSION)"
@echo "✓ Created tag v$(VERSION)"
@echo " Push with: git push origin v$(VERSION)"
## release-tag: Create and push release tag (triggers GitHub release)
release-tag: tag
git push origin "v$(VERSION)"
@echo "✓ Pushed tag v$(VERSION) - GitHub Actions will create the release"
# ============================================================================
# Help
# ============================================================================
## help: Show this help message
help:
@echo "Azul Browse v$(VERSION) - Build Commands"
@echo ""
@echo "Usage: make <target>"
@echo ""
@echo "Development:"
@grep -E '^## ' $(MAKEFILE_LIST) | grep -E '(build|release|run|test|lint|fmt|check|clean):' | \
sed 's/## / /' | sed 's/: /\t/'
@echo ""
@echo "Installation:"
@grep -E '^## ' $(MAKEFILE_LIST) | grep -E '(install|uninstall|cargo):' | \
sed 's/## / /' | sed 's/: /\t/'
@echo ""
@echo "Versioning:"
@grep -E '^## ' $(MAKEFILE_LIST) | grep -E '(version|bump|tag):' | \
sed 's/## / /' | sed 's/: /\t/'