-
Notifications
You must be signed in to change notification settings - Fork 46
/
Makefile
49 lines (38 loc) · 1.66 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
40
41
42
43
44
45
46
47
48
49
INTEGRATION := prometheus
BINARY_NAME = nri-$(INTEGRATION)
SRC_DIR = .
INTEGRATIONS_DIR = /var/db/newrelic-infra/newrelic-integrations/
CONFIG_DIR = /etc/newrelic-infra/integrations.d
GO_FILES := ./
BIN_FILES := ./cmd/nri-prometheus/
TARGET := target
GOFLAGS = -mod=readonly
all: build
build: clean compile test
clean:
@echo "=== $(INTEGRATION) === [ clean ]: removing binaries..."
@rm -rfv bin $(TARGET)
compile-deps:
@echo "=== $(INTEGRATION) === [ compile-deps ]: installing build dependencies..."
@go get -v -d -t ./...
bin/$(BINARY_NAME):
@echo "=== $(INTEGRATION) === [ compile ]: building $(BINARY_NAME)..."
@go build -v -o bin/$(BINARY_NAME) $(BIN_FILES)
compile: compile-deps bin/$(BINARY_NAME)
clean-test:
@echo "=== $(INTEGRATION) === [ compile ]: cleanup test dependencies..."
@go mod tidy
test-deps: compile-deps
@echo "=== $(INTEGRATION) === [ test-deps ]: installing testing dependencies..."
@go get -v $(TEST_DEPS)
test-only:
@echo "=== $(INTEGRATION) === [ test ]: running unit tests..."
@go test ./...
@echo "=== $(INTEGRATION) === [ install ]: installing bin/$(BINARY_NAME)..."
@sudo install -D --mode=755 --owner=root --strip $(ROOT)bin/$(BINARY_NAME) $(INTEGRATIONS_DIR)/bin/$(BINARY_NAME)
@sudo install -D --mode=644 --owner=root $(ROOT)$(INTEGRATION)-definition.yml $(INTEGRATIONS_DIR)/$(INTEGRATION)-definition.yml
@sudo install -D --mode=644 --owner=root $(ROOT)$(INTEGRATION)-config.yml.sample $(CONFIG_DIR)/$(INTEGRATION)-config.yml.sample
# Include thematic Makefiles
include $(CURDIR)/build/ci.mk
include $(CURDIR)/build/release.mk
.PHONY: all build clean compile-deps compile test install