Skip to content

Commit

Permalink
Merge pull request #23 from envato/viraptor/makefile-improve
Browse files Browse the repository at this point in the history
Fix rebuilding using make
  • Loading branch information
viraptor authored Feb 16, 2022
2 parents d7d183b + 96a7527 commit 56898bc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export GO111MODULE=on
VERSION="$(shell git describe --tags --candidates=1 --dirty)+envato"
FLAGS=-X main.Version=$(VERSION) -s -w
SOURCES=$(wildcard *.go iamy/*.go)

# To create a new release:
# $ git tag vx.x.x
Expand All @@ -14,25 +15,27 @@ FLAGS=-X main.Version=$(VERSION) -s -w

release: bin/iamy-linux-amd64 bin/iamy-darwin-amd64 bin/iamy-windows-386.exe bin/iamy-darwin-arm64 bin/iamy-freebsd-amd64

bin/iamy-darwin-arm64:
bin/iamy-darwin-arm64: $(SOURCES)
@mkdir -p bin
GOOS=darwin GOARCH=arm64 go build -o $@ -ldflags="$(FLAGS)" .

bin/iamy-linux-amd64:
bin/iamy-linux-amd64: $(SOURCES)
@mkdir -p bin
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" .

bin/iamy-darwin-amd64:
bin/iamy-darwin-amd64: $(SOURCES)
@mkdir -p bin
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" .

bin/iamy-windows-386.exe:
bin/iamy-windows-386.exe: $(SOURCES)
@mkdir -p bin
GOOS=windows GOARCH=386 go build -o $@ -ldflags="$(FLAGS)" .

bin/iamy-freebsd-amd64:
bin/iamy-freebsd-amd64: $(SOURCES)
@mkdir -p bin
GOOS=freebsd GOARCH=amd64 go build -o $@ -ldflags="$(FLAGS)" .

clean:
rm -f bin/*

.PHONY: clean release

0 comments on commit 56898bc

Please sign in to comment.