|
1 | | -.PHONY: all test lint clean install release |
| 1 | +.PHONY: all test lint clean install release patch minor major |
2 | 2 | .PHONY: linux-x64 linux-arm64 darwin-x64 darwin-arm64 win32-x64 win32-arm64 |
3 | 3 |
|
4 | 4 | BINARY_NAME := asimonim |
5 | 5 | DIST_DIR := dist/bin |
6 | 6 | GO_BUILD_FLAGS := -ldflags="$(shell scripts/ldflags.sh)" |
7 | 7 |
|
| 8 | +# Extract version from goals if present (e.g., "make release v0.1.0" or "make release patch") |
| 9 | +VERSION ?= $(filter v% patch minor major,$(MAKECMDGOALS)) |
| 10 | + |
8 | 11 | # Workaround for Gentoo Linux "hole in findfunctab" error with race detector |
9 | 12 | # See: https://bugs.gentoo.org/961618 |
10 | 13 | ifeq ($(shell test -f /etc/gentoo-release && echo yes),yes) |
@@ -33,15 +36,23 @@ lint: |
33 | 36 | release: |
34 | 37 | @if [ -z "$(VERSION)" ]; then \ |
35 | 38 | echo "Error: VERSION or bump type is required"; \ |
36 | | - echo "Usage: make release VERSION=<version|patch|minor|major>"; \ |
37 | | - echo " make release VERSION=v0.1.0 - Release explicit version"; \ |
38 | | - echo " make release VERSION=patch - Bump patch version (0.0.x)"; \ |
39 | | - echo " make release VERSION=minor - Bump minor version (0.x.0)"; \ |
40 | | - echo " make release VERSION=major - Bump major version (x.0.0)"; \ |
| 39 | + echo "Usage: make release <version|patch|minor|major>"; \ |
| 40 | + echo " make release v0.1.0 - Release explicit version"; \ |
| 41 | + echo " make release patch - Bump patch version (0.0.x)"; \ |
| 42 | + echo " make release minor - Bump minor version (0.x.0)"; \ |
| 43 | + echo " make release major - Bump major version (x.0.0)"; \ |
41 | 44 | exit 1; \ |
42 | 45 | fi |
43 | 46 | @./scripts/release.sh $(VERSION) |
44 | 47 |
|
| 48 | +# Prevent make from treating version args as file targets |
| 49 | +patch minor major: |
| 50 | + @: |
| 51 | + |
| 52 | +# Catch version tags like v0.1.0 |
| 53 | +v%: |
| 54 | + @: |
| 55 | + |
45 | 56 | # Cross-compilation targets (CGO_ENABLED=0 for pure Go) |
46 | 57 | linux-x64: |
47 | 58 | @mkdir -p $(DIST_DIR) |
|
0 commit comments