diff --git a/klone.yaml b/klone.yaml index fb78d4b..cdde901 100644 --- a/klone.yaml +++ b/klone.yaml @@ -10,40 +10,40 @@ targets: - folder_name: boilerplate repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/boilerplate - folder_name: cert-manager repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/cert-manager - folder_name: executable repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/executable - folder_name: generate-verify repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/generate-verify - folder_name: help repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/help - folder_name: klone repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/klone - folder_name: repository-base repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/repository-base - folder_name: tools repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: edeba4963e470a9f5e55ab1947aa15f5bdb2a2c3 + repo_hash: 43dfc77ac0dc7b08fbeddef87a153b40b364929b repo_path: modules/tools diff --git a/make/_shared/executable/01_mod.mk b/make/_shared/executable/01_mod.mk index 42faf34..88de69a 100644 --- a/make/_shared/executable/01_mod.mk +++ b/make/_shared/executable/01_mod.mk @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -exe_platforms := all +exe_operating_systems ?= darwin,linux,windows +exe_architectures ?= amd64,arm,arm64,ppc64le,s390x ifndef bin_dir $(error bin_dir is not set) @@ -110,7 +111,9 @@ define template_for_target $(YQ) 'with(.builds[]; select(.id == "$(1)") | .ldflags[0] = "-s")' | \ $(YQ) 'with(.builds[]; select(.id == "$(1)") | .ldflags[1] = "-w")' | \ $(YQ) 'with(.builds[]; select(.id == "$(1)") | .ldflags[2] = "$(go_$(1)_ldflags)")' | \ - $(YQ) 'with(.builds[]; select(.id == "$(1)") | .gobinary = "$(GO)")' | + $(YQ) 'with(.builds[]; select(.id == "$(1)") | .gobinary = "$(GO)")' | \ + os=$(exe_operating_systems) $(YQ) 'with(.builds[]; select(.id == "$(1)") | .goos = (env(os) | split(",")))' | \ + archs=$(exe_architectures) $(YQ) 'with(.builds[]; select(.id == "$(1)") | .goarch = (env(archs) | split(",")))' | endef ## Build the go source for release. This will build the source diff --git a/make/_shared/tools/00_mod.mk b/make/_shared/tools/00_mod.mk index d7c6a7a..7ff3c9d 100644 --- a/make/_shared/tools/00_mod.mk +++ b/make/_shared/tools/00_mod.mk @@ -109,6 +109,10 @@ KUBEBUILDER_ASSETS_VERSION=1.28.3 TOOLS += etcd=$(KUBEBUILDER_ASSETS_VERSION) TOOLS += kube-apiserver=$(KUBEBUILDER_ASSETS_VERSION) +# Additional tools can be defined to reuse the tooling in this file +ADDITIONAL_TOOLS ?= +TOOLS += $(ADDITIONAL_TOOLS) + # https://go.dev/dl/ VENDORED_GO_VERSION := 1.21.6 @@ -280,6 +284,10 @@ GO_DEPENDENCIES += defaulter-gen=k8s.io/code-generator/cmd/defaulter-gen GO_DEPENDENCIES += conversion-gen=k8s.io/code-generator/cmd/conversion-gen GO_DEPENDENCIES += helm-tool=github.com/cert-manager/helm-tool +# Additional Go dependencies can be defined to re-use the tooling in this file +ADDITIONAL_GO_DEPENDENCIES ?= +GO_DEPENDENCIES += $(ADDITIONAL_GO_DEPENDENCIES) + define go_dependency $$(bin_dir)/downloaded/tools/$1@$($(call UC,$1)_VERSION)_%: | $$(NEEDS_GO) $$(bin_dir)/downloaded/tools GOWORK=off GOBIN=$$(CURDIR)/$$(dir $$@) $$(GO) install $2@$($(call UC,$1)_VERSION)