forked from bernos/go-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (34 loc) · 913 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Name of the binary to produce
NAME=changeme
# Output dir
OUTPUT_DIR=./dist
# Path to build artifact
OUTPUT=$(OUTPUT_DIR)/$(NAME)
ifeq ($(OS),Windows_NT)
# Force cmd.exe as shell on windows to relieve
# Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4227d3)
# See http://superuser.com/questions/375029/make-interrupt-exception-caught
SHELL=C:/Windows/System32/cmd.exe
OUTPUT=$(OUTPUT_DIR)/$(NAME).exe
endif
all: compile
clean:
go clean -i -x ./...
-rm -rf $(OUTPUT_DIR)
deps:
go get -v github.com/tools/godep && \
godep save ./...
godep restore ./...
test: deps
godep go test -v ./...
compile: test
godep go build -o $(OUTPUT)
run: all
$(OUTPUT)
docker-build: deps
docker build -t $(NAME) .
docker-install: compile
cp $(OUTPUT) $(GOROOT)/bin/app
docker-run: docker-build
docker run --rm --name $(NAME) $(NAME)
.PHONY: all clean deps test compile run docker-build docker-run