Skip to content

Commit

Permalink
[chore] Fix make targets (#5690)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax authored Dec 9, 2024
1 parent 1243e92 commit f3a44c4
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include ./packaging/technical-addon/Makefile

### VARIABLES


# BUILD_TYPE should be one of (dev, release).
BUILD_TYPE?=release
VERSION?=latest
Expand All @@ -15,8 +14,8 @@ GOOS=$(shell go env GOOS)

FIND_MOD_ARGS=-type f -name "go.mod"
TO_MOD_DIR=dirname {} \; | sort | egrep '^./'
# NONROOT_MODS includes ./* dirs (excludes . dir)
NONROOT_MODS := $(shell find . $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR) )

ALL_MODS := $(shell find . $(FIND_MOD_ARGS) -exec $(TO_MOD_DIR)) $(PWD)

GOTEST=go test -p $(NUM_CORES)

Expand Down Expand Up @@ -56,19 +55,30 @@ GOTESPLIT_INDEX?=0

.DEFAULT_GOAL := all

all-modules:
@echo $(ALL_MODS) | tr ' ' '\n' | sort

.PHONY: all
all: checklicense impi lint misspell test otelcol

.PHONY: for-all
for-all:
@echo "running $${CMD} in root"
@$${CMD}
@set -e; for dir in $(NONROOT_MODS); do \
@set -e; for dir in $(ALL_MODS); do \
(cd "$${dir}" && \
echo "running $${CMD} in $${dir}" && \
$${CMD} ); \
done

# Define a delegation target for each module
.PHONY: $(ALL_MODS)
$(ALL_MODS):
@echo "Running target '$(TARGET)' in module '$@'"
$(MAKE) --no-print-directory -C $@ $(TARGET)

# Triggers each module's delegation target
.PHONY: for-all-target
for-all-target: $(ALL_MODS)

.PHONY: integration-vet
integration-vet:
@set -e; cd tests && go vet -tags integration,testutilsintegration,zeroconfig,testutils ./... && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) -tags testutils,testutilsintegration -v -timeout 5m -count 1 ./...
Expand Down Expand Up @@ -111,7 +121,7 @@ gendependabot:

.PHONY: tidy-all
tidy-all:
$(MAKE) $(FOR_GROUP_TARGET) TARGET="tidy"
$(MAKE) for-all-target TARGET="tidy"
$(MAKE) tidy

.PHONY: install-tools
Expand Down

0 comments on commit f3a44c4

Please sign in to comment.