Skip to content

Commit 3be15d4

Browse files
committed
Convert build script to make target
1 parent 1f92b52 commit 3be15d4

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
go-version: '1.20'
2121
cache: true
2222
- name: Build Release Assets
23-
run: ./build.sh
23+
run: make all
2424
env:
2525
CGO_ENABLED: '0'
2626
- name: Publish GitHub Release

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
FILES = $(shell find -type f -name '*.go')
2+
DISTRIBUTIONS = darwin-amd64 linux-amd64 windows-amd64 openbsd-amd64 freebsd-amd64 netbsd-amd64 linux-386 windows-386 openbsd-386 freebsd-386 netbsd-386
3+
targets = $(foreach distribution,$(DISTRIBUTIONS),dist/git-lzc-$(distribution)$(if $(findstring windows,$(distribution)),.exe))
24

35
git-lzc: $(FILES) go.mod go.sum
46
go build ./cmd/git-lzc/
57

8+
$(targets): dist/git-lzc-%: $(FILES) go.mod go.sum
9+
GOOS=$(word 1, $(subst -, ,$*)) GOARCH=$(word 1, $(subst ., ,$(word 2, $(subst -, ,$*)))) go build -o $@ ./cmd/git-lzc/
10+
11+
.PHONY: all
12+
all: $(targets)
13+
614
.PHONY: install
715
install: git-lzc
816
cp git-lzc /usr/local/bin/

build.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)