Skip to content

Commit 7e2976f

Browse files
authored
Makefile: fix build/% rule (#3371)
1 parent e0dd4ca commit 7e2976f

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

Makefile

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ VERSION = $(shell git describe --dirty --tags --always)
1313
GIT_COMMIT = $(shell git rev-parse HEAD)
1414
K8S_VERSION = v1.18.2
1515
REPO = github.com/operator-framework/operator-sdk
16-
SDK_BUILD_PATH = $(REPO)/cmd/operator-sdk
17-
ANSIBLE_BUILD_PATH = $(REPO)/cmd/ansible-operator
18-
HELM_BUILD_PATH = $(REPO)/cmd/helm-operator
1916
PKGS = $(shell go list ./... | grep -v /vendor/)
2017
TEST_PKGS = $(shell go list ./... | grep -v -E 'github.com/operator-framework/operator-sdk/test/')
2118
SOURCES = $(shell find . -name '*.go' -not -path "*/vendor/*")
@@ -69,14 +66,8 @@ help: ## Show this help screen
6966

7067
all: format test build/operator-sdk ## Test and Build the Operator SDK
7168

72-
install: ## Install the operator-sdk binary
73-
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(SDK_BUILD_PATH)
74-
75-
install-ansible: ## Install the ansible-operator binary
76-
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(ANSIBLE_BUILD_PATH)
77-
78-
install-helm: ## Install the helm-operator binary
79-
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) $(HELM_BUILD_PATH)
69+
install: ## Install the binaries
70+
$(Q)$(GOARGS) go install $(GO_BUILD_ARGS) ./cmd/operator-sdk ./cmd/ansible-operator ./cmd/helm-operator
8071

8172
# Code management.
8273
.PHONY: format tidy clean cli-doc lint
@@ -170,14 +161,11 @@ build/helm-operator-%-ppc64le-linux-gnu: GOARGS = GOOS=linux GOARCH=ppc64le
170161
build/helm-operator-%-s390x-linux-gnu: GOARGS = GOOS=linux GOARCH=s390x
171162
build/helm-operator-%-linux-gnu: GOARGS = GOOS=linux
172163

173-
build/operator-%: $(SOURCES) ## Build the operator-sdk binary
174-
$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(SDK_BUILD_PATH)
175-
176-
build/ansible-%: $(SOURCES) ## Build the ansible-operator binary
177-
$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(ANSIBLE_BUILD_PATH)
178-
179-
build/helm-%: $(SOURCES) ## Build the helm-operator binary
180-
$(Q)$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ $(HELM_BUILD_PATH)
164+
build/%: $(SOURCES) ## Build the operator-sdk binary
165+
$(Q){ \
166+
cmdpkg=$$(echo $* | sed "s/\(operator-sdk\|ansible-operator\|helm-operator\).*/\1/"); \
167+
$(GOARGS) go build $(GO_BUILD_ARGS) -o $@ ./cmd/$$cmdpkg; \
168+
}
181169

182170
build/%.asc: ## Create release signatures for operator-sdk release binaries
183171
$(Q){ \

0 commit comments

Comments
 (0)