forked from ekalinin/github-markdown-toc.go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (27 loc) · 795 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
EXEC=gh-md-toc
BUILD_DIR=build
BUILD_OS="windows darwin freebsd linux"
BUILD_ARCH="amd64 386"
clean:
@rm -f ${EXEC}
@rm -f ${BUILD_DIR}/*
@go clean
# http://tschottdorf.github.io/linking-golang-go-statically-cgo-testing/
build: clean
@go build --ldflags '-s' -i -o ${EXEC}
test: clean
@go test -cover -o ${EXEC}
release: test buildall
@git tag `grep "version" main.go | grep -o -E '[0-9]\.[0-9]\.[0-9]{1,2}'`
@git push --tags origin master
buildall: clean
@mkdir -p ${BUILD_DIR}
@for os in "${BUILD_OS}" ; do \
for arch in "${BUILD_ARCH}" ; do \
echo " * build $$os for $$arch"; \
GOOS=$$os GOARCH=$$arch go build -ldflags "-s" -o ${BUILD_DIR}/${EXEC}; \
cd ${BUILD_DIR}; \
tar czf ${EXEC}.$$os.$$arch.tgz ${EXEC}; \
cd - ; \
done done
@rm ${BUILD_DIR}/${EXEC}