forked from clearcontainers/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (29 loc) · 1.03 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
DESTDIR :=
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
SYSCONFDIR := $(PREFIX)/etc
SOURCES := $(shell find . 2>&1 | grep -E '.*\.(c|h|go)$$')
VERSION := ${shell cat ./VERSION}
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}")
TARGET = cc-runtime
CONFIG = configuration.toml
.DEFAULT: $(TARGET)
$(TARGET): $(SOURCES) Makefile
go build -i -ldflags "-X main.commit=${COMMIT} -X main.version=${VERSION}" -o $@ .
.PHONY: check check-go-static check-go-test coverage
$(TARGET).coverage: $(SOURCES) Makefile
go test -o $@ -covermode count
check: check-go-static check-go-test
check-go-test:
.ci/go-test.sh
check-go-static:
.ci/go-static-checks.sh $(GO_STATIC_CHECKS_ARGS)
.ci/go-no-os-exit.sh
coverage:
.ci/go-test.sh html-coverage
install:
$(QUIET_INST)install -D $(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET)
$(QUIET_INST)install -D config/$(CONFIG) $(DESTDIR)$(SYSCONFDIR)/clear-containers/$(CONFIG)
clean:
rm -f $(TARGET)