-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (30 loc) · 1.06 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
GOROOT := /usr/local/go
GOPATH := $(shell pwd)
GOBIN := $(GOPATH)/bin
PATH := $(GOROOT)/bin:$(PATH)
DEPS := github.com/mitchellh/cli github.com/ScriptRock/sftp github.com/ScriptRock/crypto/ssh github.com/ScriptRock/crypto/ssh/agent gopkg.in/gcfg.v1 github.com/pr8kerl/crypto/openpgp gopkg.in/gomail.v2
GO=$(GOROOT)/bin/go
LDFLAGS := -ldflags "-X main.commit=`git rev-parse HEAD`"
all: sftpsyncr
deps: $(DEPS)
GOPATH=$(GOPATH) go get -u $^
sftpsyncr: main.go config.go session.go push.go pull.go
# always format code
GOPATH=$(GOPATH) $(GO) fmt $^
# vet it
GOPATH=$(GOPATH) $(GO) tool vet $^
# binary
GOPATH=$(GOPATH) go build $(LDFLAGS) -o $@ -v $^
touch $@
win64: main.go config.go session.go push.go pull.go
# always format code
GOPATH=$(GOPATH) $(GO) fmt $^
# vet it
GOPATH=$(GOPATH) $(GO) tool vet $^
# binary
GOOS=windows GOARCH=amd64 GOPATH=$(GOPATH) go build $(LDFLAGS) -o sftpsyncr-win-amd64.exe -v $^
touch sftpsyncr-win-amd64.exe
.PHONY: $(DEPS) clean
clean:
rm -f sftpsyncr
GOPATH=$(GOPATH) $(GO) clean $(GOFLAGS) -i ./...