forked from epri-dev/OpenADR-VEN-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 1.52 KB
/
Makefile
File metadata and controls
68 lines (56 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
.DEFAULT_GOAL := all
COVERAGE ?= 0
DOCKER_EXTRA_ARGS ?=
# TODO: fix unmaintained failing tests
GTEST_FILTER ?= -VEN2bTestSet.*:CurlHTTPTest.*
export DOCKER_BUILDKIT ?= 1
define BUILDER
docker container run \
--env CCACHE_DIR=/openadr-ven-library/.ccache \
--init \
--rm \
--volume "$(shell pwd)":/openadr-ven-library/ \
--user $(shell id -u):$(shell id -g) \
--workdir /openadr-ven-library/ \
--tty \
$(DOCKER_EXTRA_ARGS) \
analyticsfire/openadr-ven-library-builder
endef
.PHONY: all
all: build
.PHONY: build
build: builder
$(BUILDER) cmake -B build -DTEST=1 -DCOVERAGE=$(COVERAGE)
$(BUILDER) cmake --build build --parallel $(shell nproc)
.PHONY: builder
builder:
docker image build --target builder --tag analyticsfire/openadr-ven-library-builder - < Dockerfile
.PHONY: clean
clean:
rm -rf build
.PHONY: prune
prune: | clean
docker image rm analyticsfire/openadr-ven-library-builder || true
.PHONY: shell
shell: DOCKER_EXTRA_ARGS = --interactive --tty
shell: | builder
$(BUILDER)
.PHONY: test
test:
$(BUILDER) /bin/bash -c "cd build && ./testoadr --gtest_filter="$(GTEST_FILTER)
.PHONY: coverage
coverage:
@rm -rf build/coverage.info build/coverage
@$(BUILDER) fastcov \
--compiler-directory build \
--exclude /usr/include xsd-4.0.0 oadrsd googletest-release \
--jobs $(shell nproc) \
--lcov \
--output build/coverage.info
@$(BUILDER) genhtml \
--demangle-cpp \
--legend \
--output-directory build/coverage \
--prefix /openadr-ven-library \
--show-details \
build/coverage.info