Skip to content

Commit

Permalink
Exit loop on build errors
Browse files Browse the repository at this point in the history
Since the loop is technically working, it doesn't
short-circuit Make.

Signed-off-by: Dale Haiducek <[email protected]>
  • Loading branch information
dhaiducek committed Sep 20, 2024
1 parent d820f1d commit ac72b21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ build-release:
fi
@for OS in linux darwin windows; do for ARCH in amd64 arm64; do \
echo "# Building $${OS}-$${ARCH}-PolicyGenerator"; \
GOOS=$${OS} GOARCH=$${ARCH} CGO_ENABLED=0 go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${OS}-$${ARCH}-PolicyGenerator ./cmd/PolicyGenerator; \
GOOS=$${OS} GOARCH=$${ARCH} CGO_ENABLED=0 \
go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${OS}-$${ARCH}-PolicyGenerator ./cmd/PolicyGenerator \
|| exit 1; \
done; done
# Adding .exe extension to Windows binaries
@for FILE in $$(ls -1 build_output/windows-* | grep -v ".exe$$"); do \
mv $${FILE} $${FILE}.exe; \
mv $${FILE} $${FILE}.exe \
|| exit 1; \
done

.PHONY: generate
Expand Down

0 comments on commit ac72b21

Please sign in to comment.