-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
68 lines (41 loc) · 1.21 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
SHELL := /bin/bash
PKGS := subscriber
IMAGES := subscriber
TEST_PKGS := mailchimp server
FMT_PKGS := subscriber server mailchimp
VERSION := $(shell cat ./VERSION)-$(shell git rev-parse --short HEAD)
LD_FLAGS := -ldflags "-w -s"
.PHONY: all linux push-images test fmt install deps clean
all: $(addsuffix .out, $(PKGS))
linux: $(addsuffix .linux.amd64, $(PKGS))
push-images: $(addprefix push-image-, $(IMAGES))
images: $(addprefix image-, $(IMAGES))
test: $(addprefix test-, $(TEST_PKGS))
fmt: $(addprefix fmt-, $(FMT_PKGS))
install: $(addprefix install-, $(PKGS))
deps:
glide install
clean:
find . -name "*.out" -type f -delete
find . -name "*.linux.amd64" -type f -delete
image-subscriber:
docker build -t beldpro/subscriber .
push-image-%:
docker tag beldpro/$* beldpro/$*:$(VERSION)
docker push beldpro/$*
docker push beldpro/$*:$(VERSION)
test-%:
cd $* && go test ./... -v
install-%:
cd $* && go install -v
fmt-%:
cd $* && gofmt -s -w .
infra:
docker-compose \
-p fillabe \
-f ./infra/docker/docker-compose.yml \
up
%.out:
cd $* && go build $(LD_FLAGS) -v -o $@
%.linux.amd64:
cd $* && GOOS=linux GOARCH=amd64 GCO_ENABLED=0 go build -a -installsuffix cgo $(LD_FLAGS) -v -o $@