-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (27 loc) · 969 Bytes
/
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
NAME=openccgo
DISTDIR=dist
VERSION=$(shell git describe --tags || echo "unknown version")
GOBUILD=CGO_ENABLED=0 go build -o $(DISTDIR)/$(NAME)
PLATFORM_LIST = \
darwin-amd64 \
linux-amd64 \
WINDOWS_ARCH_LIST = \
windows-amd64
# all: config.go linux-amd64 darwin-amd64 windows-amd64
darwin-amd64:
GOARCH=amd64 GOOS=darwin $(GOBUILD)-$@ .
linux-amd64:
GOARCH=amd64 GOOS=linux $(GOBUILD)-$@ .
windows-amd64:
GOARCH=amd64 GOOS=windows $(GOBUILD)[email protected] .
goBindata=$(shell go-bindata -o=config.go -pkg=main resource/...)
gz_releases=$(addsuffix .gz, $(PLATFORM_LIST))
zip_releases=$(addsuffix .zip, $(WINDOWS_ARCH_LIST))
$(gz_releases): %.gz : %
chmod +x $(DISTDIR)/$(NAME)-$(basename $@)
gzip -f -S -$(VERSION).gz $(DISTDIR)/$(NAME)-$(basename $@)
$(zip_releases): %.zip : %
zip -m -j $(DISTDIR)/$(NAME)-$(basename $@)-$(VERSION).zip $(DISTDIR)/$(NAME)-$(basename $@).exe
releases: $(goBindata) $(gz_releases) $(zip_releases)
clean:
rm -r $(DISTDIR)/*