Skip to content

Commit

Permalink
Add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hymkor committed Feb 20, 2024
1 parent c750523 commit da9257f
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=set
NUL=nul
EXE=.exe
VERSION:=v$(shell powershell "(cargo metadata --no-deps --format-version 1 | ConvertFrom-Json).packages.version")
RM=del

else
SET=export
NUL=/dev/null
EXE=
AWK=gawk
RM=rm
VERSION:=v$(shell $(AWK) '/version/{ gsub(/[=\"]/,"",$$NF) ; print $$NF ; exit }' Cargo.toml)
endif

NAME:=$(subst -rs,,$(notdir $(CURDIR)))

all:
@echo make dist/manifest/release/clean-dist

clean-dist:
$(RM) $(NAME)-*.zip

TARGET=$(ARCH)-$(VENDOR)-$(SYS)-$(ABI)
_dist:
cargo build --release --target $(TARGET)
zip -j $(NAME)-$(VERSION)-$(SYS)-$(ARCH).zip target/$(TARGET)/release/$(NAME)$(EXE)

dist:
$(MAKE) _dist ARCH=i686 VENDOR=pc SYS=windows ABI=msvc
$(MAKE) _dist ARCH=x86_64 VENDOR=pc SYS=windows ABI=msvc

manifest:
make-scoop-manifest *-windows-*.zip > $(NAME).json

release:
gh release create -d --notes "" -t $(VERSION) $(VERSION) $(wildcard $(NAME)-$(VERSION)-*.zip)

tag:
git tag $(VERSION)

.PHONY: dist manifest release

0 comments on commit da9257f

Please sign in to comment.