-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
42 lines (31 loc) · 914 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
all: bin
TAG = 0.3.0b
NAME = journald2graylog
PREFIX = hub.docker.com
ifneq ($(strip $(DOCKER_REGISTRY)),)
PREFIX = $(DOCKER_REGISTRY)
endif
REGISTRY := $(PREFIX)/$(NAME)
GOBUILD = go build -v -a
GOBUILD_RELEASE = go build -a -ldflags '-s -w'
bin_linux: clean
GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(NAME)
bin_mac: clean
GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(NAME)
bin: clean
$(GOBUILD) -o $(NAME)
docker: bin_linux
docker build --pull -t $(REGISTRY):$(TAG) .
clean:
rm -rf $(NAME) dist/
push: container
docker push $(REGISTRY):$(TAG)
dist: clean
mkdir -p dist/darwin
GOOS=darwin GOARCH=amd64 $(GOBUILD_RELEASE) -o dist/darwin/$(NAME)
cd dist/darwin && tar -czvf $(NAME)-v$(TAG).tgz $(NAME)
rm -rf dist/darwin/$(NAME)
mkdir -p dist/linux
GOOS=linux GOARCH=amd64 $(GOBUILD_RELEASE) -o dist/linux/$(NAME)
cd dist/linux && tar -czvf $(NAME)-v$(TAG).tgz $(NAME)
rm -rf dist/linux/$(NAME)