From f2133d9560e7bc920aa1ee5f5c9cabec8d3eb9fe Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Fri, 16 Dec 2022 14:11:46 +0100 Subject: [PATCH] fix makefiles --- Makefile | 2 +- components/demoplugin/Makefile | 4 ++-- components/helminstaller/Makefile | 2 +- components/ocmcli/Makefile | 14 ++++++++------ hack/cross-build.sh | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 53ab1ecfc..5bfbc274d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) VERSION := $(shell cat $(REPO_ROOT)/VERSION) EFFECTIVE_VERSION := $(VERSION)+$(shell git rev-parse HEAD) -GIT_TREE_STATE := $(shell [ -z "$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) +GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) COMMIT := $(shell git rev-parse --verify HEAD) REGISTRY := ghcr.io/mandelsoft/ocm diff --git a/components/demoplugin/Makefile b/components/demoplugin/Makefile index 6f14c1151..097b7945f 100644 --- a/components/demoplugin/Makefile +++ b/components/demoplugin/Makefile @@ -8,8 +8,8 @@ PLATFORMS = linux/amd64 linux/arm64 REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../.. VERSION = $(shell git describe --tags --exact-match 2>/dev/null|| echo "$$(cat $(REPO_ROOT)/VERSION)-dev") COMMIT = $(shell git rev-parse HEAD) -EFFECTIVE_VERSION = $(VERSION)-$(COMMIT) -GIT_TREE_STATE := $(shell [ -z "$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) +EFFECTIVE_VERSION = $(VERSION)+$(COMMIT) +GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(NAME) -type f) OCMSRCS=$(shell find $(REPO_ROOT)/pkg -type f) $(REPO_ROOT)/go.* diff --git a/components/helminstaller/Makefile b/components/helminstaller/Makefile index daf505fa9..81f20fd54 100644 --- a/components/helminstaller/Makefile +++ b/components/helminstaller/Makefile @@ -11,7 +11,7 @@ REPO_ROOT := $(shell dirname $(realpath $(l VERSION := $(shell git describe --tags --exact-match 2>/dev/null|| echo "$$(cat $(REPO_ROOT)/VERSION)") COMMIT := $(shell git rev-parse --verify HEAD) EFFECTIVE_VERSION := $(VERSION)-$(COMMIT) -GIT_TREE_STATE := $(shell [ -z "$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) +GIT_TREE_STATE := $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) GEN = $(REPO_ROOT)/gen/$(NAME) diff --git a/components/ocmcli/Makefile b/components/ocmcli/Makefile index 51acf842f..61aa2a530 100644 --- a/components/ocmcli/Makefile +++ b/components/ocmcli/Makefile @@ -4,14 +4,15 @@ PROVIDER ?= ocm.software GITHUBORG ?= open-component-model COMPONENT = $(PROVIDER)/$(NAME) OCMREPO ?= ghcr.io/$(GITHUBORG)/ocm -PLATFORMS = linux/amd64 linux/arm64 darwin/arm64 darwin/amd64 +PLATFORMS = linux/amd64 linux/arm64 darwin/arm64 darwin/amd64 windows/amd64 -REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../.. +REPO_ROOT := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))../.. +GIT_TREE_STATE = $(shell [ -z "$$(git status --porcelain 2>/dev/null)" ] && echo clean || echo dirty) VERSION = $(shell git describe --tags --exact-match 2>/dev/null|| echo "$$(cat $(REPO_ROOT)/VERSION)") COMMIT = $(shell git rev-parse HEAD) -EFFECTIVE_VERSION = $(VERSION)-$(COMMIT) +EFFECTIVE_VERSION = $(VERSION)+$(COMMIT) -CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(CMD) -type f) +CMDSRCS=$(shell find $(REPO_ROOT)/cmds/$(CMD) -type f) Makefile OCMSRCS=$(shell find $(REPO_ROOT)/pkg -type f) $(REPO_ROOT)/go.* GEN = $(REPO_ROOT)/gen/$(shell basename $(realpath .)) @@ -52,7 +53,7 @@ version: .PHONY: ca ca: $(GEN)/ca.done -$(GEN)/ca.done: $(GEN)/.exists $(GEN)/build resources.yaml $(CHARTSRCS) +$(GEN)/ca.done: $(GEN)/.exists $(GEN)/build resources.yaml $(CHARTSRCS) Makefile $(OCM) create ca -f $(COMPONENT) "$(VERSION)" --provider $(PROVIDER) --file $(GEN)/ca $(OCM) add resources --templater=spiff --file $(GEN)/ca VERSION="$(VERSION)" NAME="$(NAME)" COMMIT="$(COMMIT)" GEN="$(GEN)" PLATFORMS="$(PLATFORMS)" resources.yaml @touch $(GEN)/ca.done @@ -83,7 +84,8 @@ $(GEN)/.exists: info: @echo "ROOT: $(REPO_ROOT)" @echo "VERSION: $(VERSION)" - @echo "COMMIT; $(COMMIT)" + @echo "COMMIT: $(COMMIT)" + @echo "GIT_TREE: $(GIT_TREE_STATE)" .PHONY: describe describe: $(GEN)/ctf diff --git a/hack/cross-build.sh b/hack/cross-build.sh index 64a735a68..4cdd32273 100755 --- a/hack/cross-build.sh +++ b/hack/cross-build.sh @@ -15,10 +15,10 @@ fi mkdir -p dist -build_matrix=("linux,amd64" "darwin,amd64" "darwin,arm64" "windows,amd64") +build_matrix=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64") for i in "${build_matrix[@]}"; do - IFS=',' read os arch <<< "${i}" + IFS='/' read os arch <<< "${i}" echo "Build $os/$arch" bin_path="dist/ocm-$os-$arch"