This repository was archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (61 loc) · 1.52 KB
/
Makefile
File metadata and controls
85 lines (61 loc) · 1.52 KB
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
77
78
79
80
81
82
83
84
85
VERSION := ${shell cat ./VERSION}
DESTDIR :=
PREFIX := /usr
BINDIR=$(PREFIX)/bin
LIBEXECDIR := $(PREFIX)/libexec
LOCALSTATEDIR := /var
SOURCES := $(shell find . 2>&1 | grep -E '.*\.(c|h|go)$$')
PROXY_SOCKET := $(LOCALSTATEDIR)/run/clear-containers/proxy.sock
COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true)
COMMIT := $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO})
VERSION_COMMIT := $(if $(COMMIT),$(VERSION)-$(COMMIT),$(VERSION))
#
# Pretty printing
#
V = @
Q = $(V:1=)
QUIET_GOBUILD = $(Q:@=@echo ' GOBUILD '$@;)
QUIET_GEN = $(Q:@=@echo ' GEN '$@;)
# Entry point
all: cc-proxy
#
# proxy
#
cc-proxy: $(SOURCES) Makefile VERSION
$(QUIET_GOBUILD)go build -i -o $@ -ldflags \
"-X main.DefaultSocketPath=$(PROXY_SOCKET) -X main.Version=$(VERSION_COMMIT)"
#
# Tests
#
.PHONY: check check-go-static check-go-test
check: check-go-static check-go-test
check-go-static:
.ci/go-lint.sh
check-go-test:
.ci/go-test.sh
coverage:
.ci/go-test.sh html-coverage
#
# Documentation
#
doc:
$(Q).ci/go-doc.sh || true
#
# install
#
define INSTALL_EXEC
$(QUIET_INST)install -D $1 $(DESTDIR)$2/$1 || exit 1;
endef
define INSTALL_FILE
$(QUIET_INST)install -D -m 644 $1 $(DESTDIR)$2/$1 || exit 1;
endef
all-installable: cc-proxy
install: all-installable
$(call INSTALL_EXEC,cc-proxy,$(LIBEXECDIR)/clear-containers)
clean:
rm -f cc-proxy
#
# dist
#
dist:
git archive --format=tar --prefix=cc-proxy-$(VERSION)/ HEAD | xz -c > cc-proxy-$(VERSION).tar.xz