-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (66 loc) · 3.24 KB
/
Copy pathMakefile
File metadata and controls
80 lines (66 loc) · 3.24 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
##########################################
# Dynamic targets #
##########################################
# Exclude current and hidden directories
FIND_PATH = . -mindepth 2 -not -path '*/\.*'
# Define the list of subdirectories that contain a Makefile
SUBDIRS := $(patsubst ./%/Makefile,%,$(shell find $(FIND_PATH) -name Makefile))
TARGETS := $(SUBDIRS)
.PHONY: all $(TARGETS) help
$(TARGETS):
$(MAKE) -C $@
##########################################
# Static targets #
##########################################
include test/k8s-canaries/Makefile
include test/onhost-canaries/Makefile
help:
@echo "## Available targets:"
@echo $(TARGETS)
ARCH ?= arm64
BUILD_MODE ?= release
build-%:
@echo "Building $* with mode: $(BUILD_MODE), bin $(*) and arch: $(ARCH)"
ARCH=$(ARCH) BUILD_MODE=$(BUILD_MODE) BIN="newrelic-$(*)" PKG="newrelic_agent_control" ./build/scripts/build_binary.sh
.PHONY: tilt-up
tilt-up:
tilt up ; tilt down
COVERAGE_OUT_FORMAT ?= lcov
COVERAGE_OUT_FILEPATH ?= coverage/lcov.info
coverage: llvm-cov
@echo "Generating coverage report..."
@cargo llvm-cov clean --workspace
@cargo llvm-cov --no-report --locked --all-features --lib
@mkdir -p coverage
@cargo llvm-cov report --$(COVERAGE_OUT_FORMAT) --output-path $(COVERAGE_OUT_FILEPATH)
.PHONY: llvm-cov
llvm-cov:
@echo "Checking if llvm-cov is installed..."
@which cargo-llvm-cov || cargo install cargo-llvm-cov --locked
# Build rustdoc for the whole workspace. RUSTDOCFLAGS mirrors CI so broken doc
# links / invalid HTML fail locally too. Use `make doc-open` to open in a browser.
RUSTDOCFLAGS_DOC ?= --cfg docsrs -D warnings
.PHONY: doc
doc:
@echo "Building workspace documentation..."
@RUSTDOCFLAGS="$(RUSTDOCFLAGS_DOC)" cargo doc --no-deps --workspace
.PHONY: doc-open
doc-open:
@echo "Building and opening workspace documentation..."
@RUSTDOCFLAGS="$(RUSTDOCFLAGS_DOC)" cargo doc --no-deps --workspace --open
.PHONY: third-party-notices
third-party-notices:
@echo "Checking third-party licenses..."
@(cargo install --list | grep cargo-deny) || cargo install cargo-deny --locked
@(cargo install --list | grep rust-licenses-noticer) || cargo install --git https://github.com/newrelic/rust-licenses-noticer.git --locked
@LICENSES=$$(cargo deny --all-features --locked --manifest-path ./Cargo.toml list -l crate -f json 2>&1); \
$$HOME/.cargo/bin/rust-licenses-noticer --dependencies "$$(printf "%s " $$LICENSES)" --template-file "./THIRD_PARTY_NOTICES.md.tmpl" --output-file "./THIRD_PARTY_NOTICES.md"
.PHONY: third-party-notices-check
third-party-notices-check: third-party-notices
@git diff --name-only | grep -q "THIRD_PARTY_NOTICES.md" && { echo "Third party notices out of date, please commit the changes to the THIRD_PARTY_NOTICES.md file."; exit 1; } || exit 0
# rt-update-changelog runs the release-toolkit run.sh script by piping it into bash to update the CHANGELOG.md.
# It also passes down to the script all the flags added to the make target. To check all the accepted flags,
# see: https://github.com/newrelic/release-toolkit/blob/main/contrib/ohi-release-notes/run.sh
# e.g. `make rt-update-changelog -- -v`
rt-update-changelog:
curl "https://raw.githubusercontent.com/newrelic/release-toolkit/v1/contrib/ohi-release-notes/run.sh" | bash -s -- $(filter-out $@,$(MAKECMDGOALS))