forked from ehazlett/interlock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (34 loc) · 1.11 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
BUILDTAGS=interlock
CGO_ENABLED=0
GOOS=linux
GOARCH=amd64
COMMIT=`git rev-parse --short HEAD`
APP=interlock
REPO?=ehazlett/$(APP)
TAG?=latest
SHELL=/bin/bash
BUILD?=-dev
PACKAGES=$(shell go list ./... | grep -v /vendor/)
export GO15VENDOREXPERIMENT=1
export GOPATH:=$(PWD)/vendor:$(GOPATH)
all: image
deps:
@rm -rf Godeps vendor
@godep save ./...
build: build-static
build-app:
@cd cmd/$(APP) && go build -ldflags "-w -X github.com/$(REPO)/version.GitCommit=$(COMMIT) -X github.com/$(REPO)/version.Build=$(BUILD)" .
@echo "Built $$(./cmd/$(APP)/$(APP) -v)"
build-static:
@cd cmd/$(APP) && go build -a -tags "netgo static_build" -installsuffix netgo -ldflags "-w -X github.com/$(REPO)/version.GitCommit=$(COMMIT) -X github.com/$(REPO)/version.Build=$(BUILD)" .
@echo "Built $$(./cmd/$(APP)/$(APP) -v)"
build-image:
@echo "Building image with $$(./cmd/$(APP)/$(APP) -v)"
@docker build -t $(REPO):$(TAG) .
@echo "Image created: $(REPO):$(TAG)"
test:
@go test -v -cover -race ${PACKAGES}
image: build-app build-image
clean:
@rm cmd/$(APP)/$(APP)
.PHONY: add-deps build build-static build-app build-image image clean test