-
Notifications
You must be signed in to change notification settings - Fork 113
/
Makefile
76 lines (57 loc) · 2.4 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
68
69
70
71
72
73
74
75
76
#----------------------------------------------------------------------------------
# Base
#----------------------------------------------------------------------------------
ROOTDIR := $(shell pwd)
OUTPUT_DIR ?= $(ROOTDIR)/_output
SOURCES := $(shell find . -name "*.go" | grep -v test.go)
#VERSION ?= $(shell git describe --tags)
# TODO: use the above instead
VERSION ?= dev
#----------------------------------------------------------------------------------
# Repo init
#----------------------------------------------------------------------------------
# https://www.viget.com/articles/two-ways-to-share-git-hooks-with-your-team/
.PHONY: init
init:
git config core.hooksPath .githooks
#----------------------------------------------------------------------------------
# Generated Code
#----------------------------------------------------------------------------------
.PHONY: generated-code
generated-code:
go generate ./... && gofmt -w pkg && goimports -w pkg
#################
#################
# #
# Build #
# #
# #
#################
#################
#################
#----------------------------------------------------------------------------------
# SuperGloo
#----------------------------------------------------------------------------------
SOURCES=$(shell find . -name "*.go" | grep -v test )
$(OUTPUT_DIR)/supergloo-linux-amd64: $(SOURCES)
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o $@ cmd/main.go
.PHONY: supergloo
supergloo: $(OUTPUT_DIR)/supergloo-linux-amd64
$(OUTPUT_DIR)/Dockerfile.supergloo: cmd/Dockerfile
cp $< $@
supergloo-docker: $(OUTPUT_DIR)/supergloo-linux-amd64 $(OUTPUT_DIR)/Dockerfile.supergloo
docker build -t soloio/supergloo:$(VERSION) $(OUTPUT_DIR) -f $(OUTPUT_DIR)/Dockerfile.supergloo
supergloo-docker-push: supergloo-docker
docker push soloio/supergloo:$(VERSION)
#----------------------------------------------------------------------------------
# SuperGloo Server (for local testing)
#----------------------------------------------------------------------------------
.PHONY: supergloo-server
supergloo-server:
cd cmd && go build -o $(GOPATH)/bin/supergloo-server
#----------------------------------------------------------------------------------
# SuperGloo CLI
#----------------------------------------------------------------------------------
.PHONY: install-cli
install-cli:
cd cli/cmd && go build -o $(GOPATH)/bin/supergloo