forked from bgadrian/medium-to-hugo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
26 lines (21 loc) · 796 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
# Makefile
BINARY="m2h"
TARGET="build"
VERSION="v0.4"
export GO111MODULE=on
LDFLAGS=-ldflags "-extldflags '-static' -s -w"
.DEFAULT_GOAL: $(BINARY)
$(BINARY): clean
mkdir -p ${TARGET}
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -a -o ${TARGET}/${BINARY}
chmod +x ${TARGET}/${BINARY}
release: clean
mkdir -p ${TARGET}/release
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -a -o ${TARGET}/release/${BINARY}-${VERSION}-linux-amd64
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -a -o ${TARGET}/release/${BINARY}-${VERSION}-win-amd64
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -a -o ${TARGET}/release/${BINARY}-${VERSION}-darwin-amd64
chmod -R +x ${TARGET}/release
clean:
go clean
rm -rf ${TARGET}
# go get -d ./