-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
44 lines (31 loc) · 1.8 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
41
42
43
44
GO_EXECUTABLE := go
VERSION := $(shell git describe --abbrev=10 --dirty --always --tags)
VERSION_PACKAGE := github.com/evolbioinfo/goalign/version.Version
NAME := goalign
PACKAGE:=github.com/evolbioinfo/goalign
CGO_ENABLED:=0
all: dep build test
dep:
${GO_EXECUTABLE} get .
build:
CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} build -o ${NAME} -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}
install: testcommands
rm -f ${GOPATH}/bin/${NAME}
CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} install -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}
test: dep
CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} test ${PACKAGE}/...
testcommands:
bash ./test.sh
.PHONY: deploy deploydir deploywinamd deploywin386 deploylinuxamd deploylinux386 deploydarwinamd
deploy: deploywinamd deploywin386 deploylinuxamd deploylinux386 deploydarwinamd deploydarwinarm
tar -czvf deploy/${VERSION}.tar.gz --directory="deploy" ${VERSION}
deploydir:
mkdir -p deploy/${VERSION}
deploywinamd: dep deploydir
env GOOS=windows GOARCH=amd64 CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_${VERSION}_amd64.exe -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}
deploylinuxamd: dep deploydir
env GOOS=linux GOARCH=amd64 CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_${VERSION}_amd64_linux -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}
deploydarwinamd: dep deploydir
env GOOS=darwin GOARCH=amd64 CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_${VERSION}_amd64_darwin -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}
deploydarwinarm: dep deploydir
env GOOS=darwin GOARCH=arm64 CGO_ENABLED=${CGO_ENABLED} ${GO_EXECUTABLE} build -o deploy/${VERSION}/${NAME}_${VERSION}_arm64_darwin -ldflags "-X ${VERSION_PACKAGE}=${VERSION}" ${PACKAGE}