-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (36 loc) · 830 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
48
49
50
51
#!/usr/bin/make -ef
GO ?= go
NAME = go-pubsub-daemon
CLIENT_NAME = $(NAME)-client
MODULE_NAME = github.com/bahner/go-pubsub-daemon
PREFIX ?= /usr/local
ifneq (,$(wildcard ./.env))
include .env
export
endif
all: build image client
build: tidy $(NAME)
$(NAME): tidy
$(GO) build -o $(NAME)
tidy: go.mod
$(GO) mod tidy
serve: build
./$(NAME)
image:
docker build \
-t $(IMAGE) \
--build-arg "BUILD_IMAGE=$(BUILD_IMAGE)" \
.
go.mod:
$(GO) mod init $(MODULE_NAME)
install: build client
sudo install -Dm755 $(NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME)
sudo install -Dm755 client/$(CLIENT_NAME) $(DESTDIR)$(PREFIX)/bin/$(NAME)-client
client:
make -C client
clean:
rm -f $(NAME)
make -C client clean
distclean: clean
rm -f $(shell git ls-files --exclude-standard --others)
.PHONY: build client serve tidy