-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
31 lines (28 loc) · 842 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=demo
BINARY_UNIX=$(BINARY_NAME)_unix
all: test build
build:
$(GOBUILD) -v -ldflags "-s -w" -o $(BINARY_NAME)
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
run:
$(GOBUILD) -o $(BINARY_NAME) -v ./...
./$(BINARY_NAME)
deps:
$(GOGET) github.com/GeertJohan/go.rice
$(GOGET) github.com/GeertJohan/go.rice/rice
# Cross compilation
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -a -ldflags "-s -w" -o $(BINARY_UNIX) -v
docker-build:
docker run --rm -it -v "$(GOPATH)":/go -w /go/src/bitbucket.org/rsohlich/makepost golang:latest go build -a -ldflags "-s -w" -o "$(BINARY_UNIX)" -v