Skip to content

Commit eb1ae6e

Browse files
committed
Add build scripts
1 parent a102fe7 commit eb1ae6e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
*.so
55
*.dylib
66

7+
# Ignore dist
8+
dist
9+
flora
10+
711
# Test binary, build with `go test -c`
812
*.test
913

Makefile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
VERSION ?= $(git describe --tags)
2+
DIST_DIRS := find * -type d -exec
3+
4+
init:
5+
go get -u github.com/laher/goxc
6+
dep ensure
7+
8+
build:
9+
go build -ldflags "-X main.version=${VERSION}" cmd/flora/flora.go
10+
11+
build-all:
12+
gox -verbose \
13+
-ldflags "-X main.version=${VERSION}" \
14+
-os="linux darwin windows" \
15+
-arch="amd64" \
16+
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" ./cmd/flora/
17+
18+
pre-dist:
19+
go get github.com/mitchellh/gox
20+
mkdir -p dist
21+
22+
dist: pre-dist build-all
23+
cd dist && \
24+
$(DIST_DIRS) cp ../LICENSE {} \; && \
25+
$(DIST_DIRS) cp ../README.md {} \; && \
26+
$(DIST_DIRS) tar -zcf flora-${VERSION}-{}.tar.gz {} \; && \
27+
$(DIST_DIRS) zip -r flora-${VERSION}-{}.zip {} \; && \
28+
cd ..
29+
30+
vet:
31+
go tool vet .
32+
33+
all: bootastrap vet dist
34+
35+
.PHONY: init build build-darwin build-win build-all dist vet

0 commit comments

Comments
 (0)