From dcb5b4add5a003b9bc4e70696995f46ad373a3d6 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Wed, 19 Jan 2022 16:41:32 +0100 Subject: [PATCH] Define source code dependencies in Makefile --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e82685e..f49162e 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,27 @@ APP = cc-metric-collector +GOSRC_APP := metric-collector.go +GOSRC_COLLECTORS := $(wildcard collectors/*.go) +GOSRC_SINKS := $(wildcard sinks/*.go) +GOSRC_RECEIVERS := $(wildcard receivers/*.go) +GOSRC := $(GOSRC_APP) $(GOSRC_COLLECTORS) $(GOSRC_SINKS) $(GOSRC_RECEIVERS) +.PHONY: all all: $(APP) -$(APP): metric-collector.go +$(APP): $(GOSRC) make -C collectors go get - go build -o $(APP) metric-collector.go + go build -o $(APP) $(GOSRC_APP) +.PHONY: clean clean: make -C collectors clean rm -f $(APP) +.PHONY: fmt fmt: - go fmt collectors/*.go - go fmt sinks/*.go - go fmt receivers/*.go - go fmt metric-collector.go + go fmt $(GOSRC_COLLECTORS) + go fmt $(GOSRC_SINKS) + go fmt $(GOSRC_RECEIVERS) + go fmt $(GOSRC_APP) -.PHONY: clean