Skip to content

Commit

Permalink
chore: Add release Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Nov 19, 2021
1 parent 4a7ef46 commit 761be71
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target
bin
ca
.vscode
.idea
57 changes: 57 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
NAME=good-mitm
BINDIR=bin
VERSION=$(shell git describe --tags || echo "unknown version")
UPX=upx --best
STRIP=llvm-strip -s
CROSS_BUILD=cross build --release --target

all: fmt clippy build

build:
cargo build

clean:
cargo clean

deps:
cargo install cargo-strip xargo cross

fmt:
cargo fmt --all

clippy:
cargo clippy

a: fmt clippy


CROSS_TARGET_LIST = \
x86_64-unknown-linux-musl \
i686-unknown-linux-musl \
aarch64-unknown-linux-musl \
armv7-unknown-linux-musleabihf \

$(CROSS_TARGET_LIST):
$(CROSS_BUILD) $@
cp "target/$@/release/$(NAME)" "$(BINDIR)/$(NAME)-$@"
$(STRIP) "$(BINDIR)/$(NAME)-$@"
$(UPX) "$(BINDIR)/$(NAME)-$@"

windows:
cargo build --target x86_64-pc-windows-gnu --release
cp "target/x86_64-pc-windows-gnu/release/$(NAME).exe" "$(BINDIR)/$(NAME)-x86_64-pc-windows-gnu.exe"
$(UPX) "$(BINDIR)/$(NAME)-x86_64-pc-windows-gnu.exe"

bindir:
rm -rf $(BINDIR)
mkdir $(BINDIR)

bin_gz=$(addsuffix .gz, $(CROSS_TARGET_LIST))

$(bin_gz): %.gz : %
chmod +x $(BINDIR)/$(NAME)-$(basename $@)
gzip -f -S -$(VERSION).gz $(BINDIR)/$(NAME)-$(basename $@)

gz_release: $(bin_gz)

release: bindir gz_release
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![GitHub stars](https://img.shields.io/github/stars/zu1k/good-mitm)](https://github.com/zu1k/good-mitm/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/zu1k/good-mitm)](https://github.com/zu1k/good-mitm/network)
[![Release](https://img.shields.io/github/release/zu1k/good-mitm)](https://github.com/zu1k/good-mitm/releases)
[![GitHub issues](https://img.shields.io/github/issues/zu1k/good-mitm)](https://github.com/zu1k/good-mitm/issues)
[![Build](https://github.com/zu1k/good-mitm/actions/workflows/build.yml/badge.svg)](https://github.com/zu1k/good-mitm/actions/workflows/build.yml)
[![GitHub license](https://img.shields.io/github/license/zu1k/good-mitm)](https://github.com/zu1k/good-mitm/blob/master/LICENSE)
Expand Down

0 comments on commit 761be71

Please sign in to comment.