Skip to content

Commit a4c1c46

Browse files
authored
Merge pull request #177 from maxdrib/fix-makefile
Fixing Makefile bugs
2 parents e8988e4 + 74fde65 commit a4c1c46

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ROOT_DIR_RELATIVE := .
15+
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
1616

17-
include $(ROOT_DIR_RELATIVE)/common.mk
17+
include $(REPO_ROOT)/common.mk
1818

1919
# Directories
20-
TOOLS_DIR := hack/tools
20+
TOOLS_DIR := $(REPO_ROOT)/hack/tools
2121
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
2222
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
2323
BIN_DIR ?= bin
2424
RELEASE_DIR ?= out
2525

26-
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
2726
GH_REPO ?= kubernetes-sigs/cluster-api-provider-cloudstack
2827

2928
# Binaries
@@ -86,7 +85,7 @@ all: build
8685
## --------------------------------------
8786

8887
.PHONY: binaries
89-
binaries: $(CONTROLLER_GEN KUSTOMIZE) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO_V1) $(GINKGO_V2) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
88+
binaries: $(CONTROLLER_GEN) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO_V1) $(GINKGO_V2) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
9089

9190
.PHONY: managers
9291
managers:
@@ -247,7 +246,8 @@ cluster-api/tilt-settings.json: hack/tilt-settings.json cluster-api
247246
## --------------------------------------
248247
## Tests
249248
## --------------------------------------
250-
export KUBEBUILDER_ASSETS=$(REPO_ROOT)/$(TOOLS_BIN_DIR)
249+
250+
export KUBEBUILDER_ASSETS=$(TOOLS_BIN_DIR)
251251
DEEPCOPY_GEN_TARGETS_TEST=$(shell find test/fakes -type d -name "fakes" -exec echo {}\/zz_generated.deepcopy.go \;)
252252
DEEPCOPY_GEN_INPUTS_TEST=$(shell find test/fakes/* -name "*zz_generated*" -prune -o -type f -print)
253253
.PHONY: generate-deepcopy-test

common.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include $(ROOT_DIR_RELATIVE)/versions.mk
15+
include $(REPO_ROOT)/versions.mk
1616

1717
# Ensure Make is run with bash shell as some syntax below is bash-specific
1818
SHELL:=bash
1919
.ONESHELL:
20-
.SHELLFLAGS := -eu -o pipefail -c
20+
.SHELLFLAGS := -euc # No spaces allowed in linux SHELLFLAGS, so omitting -o pipefail
2121
.DELETE_ON_ERROR:
2222
MAKEFLAGS += --no-builtin-rules
2323

24-
TOOLS_DIR := $(ROOT_DIR_RELATIVE)/hack/tools
24+
TOOLS_DIR := $(REPO_ROOT)/hack/tools
2525
TOOLS_DIR_DEPS := $(TOOLS_DIR)/go.sum $(TOOLS_DIR)/go.mod $(TOOLS_DIR)/Makefile
2626
TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
2727
UID := $(shell id -u)

docs/book/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ROOT_DIR_RELATIVE := ../..
16-
include $(ROOT_DIR_RELATIVE)/common.mk
15+
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
16+
17+
include $(REPO_ROOT)/common.mk
1718

1819
# Directories.
1920
MDBOOK := $(TOOLS_BIN_DIR)/mdbook

hack/tools/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
ROOT_DIR_RELATIVE := ../..
16-
include $(ROOT_DIR_RELATIVE)/common.mk
15+
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
16+
include $(REPO_ROOT)/common.mk
1717

1818
UNAME := $(shell uname -s)
1919

0 commit comments

Comments
 (0)