Skip to content

Commit

Permalink
Add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
HAYAMA_Kaoru committed Oct 23, 2021
1 parent fbe5888 commit 621452e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
NAME=$(lastword $(subst /, ,$(abspath .)))
VERSION=$(shell git.exe describe --tags 2>nul || echo noversion)
GOOPT=-ldflags "-s -w -X main.version=$(VERSION)"

ifeq ($(OS),Windows_NT)
SHELL=CMD.EXE
SET=SET
else
SET=export
endif

all:
go fmt
go build $(GOOPT)

_package:
go fmt
go build $(GOOPT)
zip $(NAME)-$(VERSION)-$(GOOS)-$(GOARCH).zip $(NAME)$(EXT)

package:
$(SET) "GOOS=linux" && $(SET) "GOARCH=386" && $(MAKE) _package EXT=
$(SET) "GOOS=linux" && $(SET) "GOARCH=amd64" && $(MAKE) _package EXT=
$(SET) "GOOS=windows" && $(SET) "GOARCH=386" && $(MAKE) _package EXT=.exe
$(SET) "GOOS=windows" && $(SET) "GOARCH=amd64" && $(MAKE) _package EXT=.exe

test:
go test -v

0 comments on commit 621452e

Please sign in to comment.