Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Makefile] Fix issues with common targets #9775

Merged
merged 1 commit into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ all-modules:
@echo $(ALL_MODULES) | tr ' ' '\n' | sort

.PHONY: all
all: common gotest otelcontribcol otelcontribcol-unstable
all: all-common gotest otelcontribcol otelcontribcol-unstable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the rule between common and non-common? Should test be there as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point. It's not very consistent. I will write up a new issue to proposal guidelines on how targets should be scoped.


.PHONY: all-common
all-common:
@$(MAKE) for-all-target TARGET="common"

.PHONY: e2e-test
e2e-test: otelcontribcol otelcontribcol-unstable otelcontribcol-testbed
Expand Down
30 changes: 18 additions & 12 deletions Makefile.Common
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
# SRC_ROOT is the top of the source tree.
SRC_ROOT := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

ALL_SRC := $(shell find . -name '*.go' \
-not -path '*/third_party/*' \
-type f | sort)

# All source code and documents. Used in spell check.
ALL_SRC_AND_DOC := $(shell find . \( -name "*.md" -o -name "*.go" -o -name "*.yaml" \) \
-type f | sort)

# ALL_PKGS is used with 'go cover'
ALL_PKGS := $(shell $(GOCMD) list $(sort $(dir $(ALL_SRC))) 2>/dev/null)

# build tags required by any component should be defined as an independent variables and later added to GO_BUILD_TAGS below
GO_BUILD_TAGS=""
GOTEST_OPT?= -race -v -timeout 300s --tags=$(GO_BUILD_TAGS)
Expand All @@ -30,16 +19,33 @@ IMPI=impi
# BUILD_TYPE should be one of (dev, release).
BUILD_TYPE?=release

ALL_PKG_DIRS := $(shell $(GOCMD) list -f '{{ .Dir }}' ./... | sort)

ALL_SRC := $(shell find $(ALL_PKG_DIRS) -name '*.go' \
-not -path '*/third_party/*' \
-type f | sort)

# All source code and documents. Used in spell check.
ALL_SRC_AND_DOC := $(shell find $(ALL_PKG_DIRS) -name "*.md" -o -name "*.go" -o -name "*.yaml" \
-not -path '*/third_party/*' \
-type f | sort)

# ALL_PKGS is used with 'go cover'
ALL_PKGS := $(shell $(GOCMD) list $(sort $(dir $(ALL_SRC))))

all-pkgs:
@echo $(ALL_PKGS) | tr ' ' '\n' | sort

all-srcs:
@echo $(ALL_SRC) | tr ' ' '\n' | sort

all-pkg-dirs:
@echo $(ALL_PKG_DIRS) | tr ' ' '\n' | sort

.DEFAULT_GOAL := common

.PHONY: common
common: checklicense checkdoc impi lint misspell
common: checklicense impi lint misspell

.PHONY: test
test:
Expand Down