-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (29 loc) · 1.03 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
VERSION := $(shell sh -c 'git describe --always --tags')
LDFLAGS := -ldflags "-X main.version=$(VERSION)"
all: build
build: *.go cmd/mangaeden/*.go clean-build
cd cmd/mangaeden/ && go build -o ../../bin/mangaeden $(LDFLAGS)
define go_dist
mkdir -p dist/mangaeden-$(VERSION)_$1_$2/
cd dist/mangaeden-$(VERSION)_$1_$2/ && GOOS=$1 GOARCH=$2 go build -v $(LDFLAGS) github.com/kmwenja/mangaeden/cmd/mangaeden
if [ "$1" = "windows" ]; then \
cd dist/ && zip mangaeden-$(VERSION)_$1_$2.zip mangaeden-$(VERSION)_$1_$2/*; \
else \
cd dist/ && tar -cvzf mangaeden-$(VERSION)_$1_$2.tar.gz mangaeden-$(VERSION)_$1_$2/*; \
fi
endef
dist: clean-dist dist-linux dist-macos dist-windows
dist-macos:
$(call go_dist,darwin,amd64)
dist-linux:
$(call go_dist,linux,amd64)
$(call go_dist,linux,386)
dist-windows:
go get -v github.com/inconshreveable/mousetrap
$(call go_dist,windows,amd64)
clean: clean-build clean-dist
clean-build:
rm -rf ./bin
clean-dist:
rm -rf ./dist
.PHONY = clean clean-build clean-dist dist dist-linux dist-macos dist-windows