Skip to content

Commit 5e5f0a1

Browse files
Merge pull request #26963 from Luap99/fix-local-cross
Revert "Remove bin/podman.cross Make target"
2 parents 6d0b28a + 5c810ea commit 5e5f0a1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,20 @@ podman-testing: bin/podman-testing
481481
generate-bindings: .install.golangci-lint
482482
$(GOCMD) generate ./pkg/bindings/... ;
483483

484+
# Do the cross build with the OS/ARCH extrcted from the target name, i.e.
485+
# pass a path like "podman.cross.linux.amd64". This target is used by
486+
# local-cross to build all CROSS_BUILD_TARGETS.
487+
bin/podman.cross.%: $(SOURCES)
488+
TARGET="$*"; \
489+
GOOS="$${TARGET%%.*}"; \
490+
GOARCH="$${TARGET##*.}"; \
491+
CGO_ENABLED=0 \
492+
$(GO) build \
493+
$(BUILDFLAGS) \
494+
$(GO_LDFLAGS) '$(LDFLAGS_PODMAN)' \
495+
-tags '$(BUILDTAGS_CROSS)' \
496+
-o "$@" ./cmd/podman
497+
484498
.PHONY: local-cross
485499
local-cross: $(CROSS_BUILD_TARGETS) ## Cross compile podman binary for multiple architectures
486500

0 commit comments

Comments
 (0)