-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (55 loc) · 1.42 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
PROJECT = github.com/albertrdixon/tmplnator
TEST_COMMAND = go test
EXECUTABLE = t2
PKG = cmd/t2/t2.go
LDFLAGS = -s
PLATFORMS = linux darwin
BUILD_ARGS = ""
TOOLS = glide
.PHONY: save restore test test-verbose build install package clean
all: test install
help:
@echo "Available targets:"
@echo ""
@echo " save"
@echo " restore"
@echo " test"
@echo " test-verbose"
@echo " build"
@echo " install"
@echo " package"
@echo " clean"
tools:
go get -u -v -ldflags -s github.com/Masterminds/glide
save:
@echo "---> Saving dependencies..."
@glide update
restore:
@echo "---> Restoring dependencies..."
@glide install
test:
@echo "---> Running all tests"
@echo ""
@$(TEST_COMMAND) .
test-verbose:
@echo "---> Running all tests (verbose output)"
@ echo ""
@$(TEST_COMMAND) -test.v .
build:
@echo "---> Building executables"
@ GOOS=linux CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags $(LDFLAGS) -o bin/$(EXECUTABLE)-linux $(PKG)
@ GOOS=darwin CGO_ENABLED=0 go build -a -ldflags $(LDFLAGS) -o bin/$(EXECUTABLE)-darwin $(PKG)
install:
@echo "---> Installing..."
@CGO_ENABLED=0 go install -a -ldflags $(LDFLAGS) $(PKG)
package: build
@for p in $(PLATFORMS) ; do \
echo "---> Tar'ing up $$p/amd64 binary" ; \
test -f bin/$(EXECUTABLE)-$$p && \
cp bin/$(EXECUTABLE)-$$p t2 && \
tar czf $(EXECUTABLE)-$$p.tgz t2 ; \
done
clean:
@echo "---> Cleaning up workspace..."
@go clean ./...
@rm -rf t2* tnator*.tar.gz