mirror of https://github.com/containers/podman.git
Make Go builds more consistent
* Use the BUILDFLAGS variable for all Go builds * Use `go install` instead of manually specifying the GOBIN path Signed-off-by: Jordan Christiansen <xordspar0@gmail.com>
This commit is contained in:
parent
031ddf9c84
commit
36318e5cab
18
Makefile
18
Makefile
|
@ -38,7 +38,7 @@ PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit
|
||||||
|
|
||||||
SOURCES = $(shell find . -path './.*' -prune -o -name "*.go")
|
SOURCES = $(shell find . -path './.*' -prune -o -name "*.go")
|
||||||
|
|
||||||
GO_BUILD ?= $(GO) build -mod=vendor
|
BUILDFLAGS := -mod=vendor $(BUILDFLAGS)
|
||||||
|
|
||||||
BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
|
BUILDTAGS_CROSS ?= containers_image_openpgp exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_overlay
|
||||||
ifneq (,$(findstring varlink,$(BUILDTAGS)))
|
ifneq (,$(findstring varlink,$(BUILDTAGS)))
|
||||||
|
@ -170,11 +170,11 @@ gofmt: ## Verify the source code gofmt
|
||||||
|
|
||||||
.PHONY: test/checkseccomp/checkseccomp
|
.PHONY: test/checkseccomp/checkseccomp
|
||||||
test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
|
test/checkseccomp/checkseccomp: .gopathok $(wildcard test/checkseccomp/*.go)
|
||||||
$(GO_BUILD) -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp
|
$(GO) build $(BUILDFLAGS) -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./test/checkseccomp
|
||||||
|
|
||||||
.PHONY: test/goecho/goechoe
|
.PHONY: test/goecho/goechoe
|
||||||
test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go)
|
test/goecho/goecho: .gopathok $(wildcard test/goecho/*.go)
|
||||||
$(GO_BUILD) -ldflags '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho
|
$(GO) build $(BUILDFLAGS) -ldflags '$(LDFLAGS_PODMAN)' -o $@ ./test/goecho
|
||||||
|
|
||||||
|
|
||||||
.PHONY: bin/podman
|
.PHONY: bin/podman
|
||||||
|
@ -184,18 +184,18 @@ ifeq (,$(findstring systemd,$(BUILDTAGS)))
|
||||||
@echo "Podman is being compiled without the systemd build tag. Install libsystemd on \
|
@echo "Podman is being compiled without the systemd build tag. Install libsystemd on \
|
||||||
Ubuntu or systemd-devel on rpm based distro for journald support."
|
Ubuntu or systemd-devel on rpm based distro for journald support."
|
||||||
endif
|
endif
|
||||||
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./cmd/podman
|
$(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS)" -o $@ ./cmd/podman
|
||||||
|
|
||||||
.PHONY: podman
|
.PHONY: podman
|
||||||
podman: bin/podman
|
podman: bin/podman
|
||||||
|
|
||||||
.PHONY: bin/podman-remote
|
.PHONY: bin/podman-remote
|
||||||
bin/podman-remote: .gopathok $(SOURCES) go.mod go.sum $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote environment
|
bin/podman-remote: .gopathok $(SOURCES) go.mod go.sum $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on remote environment
|
||||||
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "${REMOTETAGS}" -o $@ ./cmd/podman
|
$(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "${REMOTETAGS}" -o $@ ./cmd/podman
|
||||||
|
|
||||||
.PHONY: bin/podman-remote-static
|
.PHONY: bin/podman-remote-static
|
||||||
podman-remote-static: bin/podman-remote-static
|
podman-remote-static: bin/podman-remote-static
|
||||||
CGO_ENABLED=0 $(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN_STATIC)' -tags "${REMOTETAGS}" -o bin/podman-remote-static ./cmd/podman
|
CGO_ENABLED=0 $(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN_STATIC)' -tags "${REMOTETAGS}" -o bin/podman-remote-static ./cmd/podman
|
||||||
|
|
||||||
.PHONY: podman-remote
|
.PHONY: podman-remote
|
||||||
podman-remote: bin/podman-remote
|
podman-remote: bin/podman-remote
|
||||||
|
@ -209,7 +209,7 @@ podman.msi: podman-remote podman-remote-windows install-podman-remote-windows-do
|
||||||
|
|
||||||
podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
|
podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
|
||||||
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
|
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
|
||||||
CGO_ENABLED=0 GOOS=$* $(GO_BUILD) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "${REMOTETAGS}" -o bin/$@$(BINSFX) ./cmd/podman
|
CGO_ENABLED=0 GOOS=$* $(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "${REMOTETAGS}" -o bin/$@$(BINSFX) ./cmd/podman
|
||||||
|
|
||||||
local-cross: $(CROSS_BUILD_TARGETS) ## Cross local compilation
|
local-cross: $(CROSS_BUILD_TARGETS) ## Cross local compilation
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ bin/podman.cross.%: .gopathok
|
||||||
TARGET="$*"; \
|
TARGET="$*"; \
|
||||||
GOOS="$${TARGET%%.*}" \
|
GOOS="$${TARGET%%.*}" \
|
||||||
GOARCH="$${TARGET##*.}" \
|
GOARCH="$${TARGET##*.}" \
|
||||||
$(GO_BUILD) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags '$(BUILDTAGS_CROSS)' -o "$@" ./cmd/podman
|
$(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags '$(BUILDTAGS_CROSS)' -o "$@" ./cmd/podman
|
||||||
|
|
||||||
# Update nix/nixpkgs.json its latest stable commit
|
# Update nix/nixpkgs.json its latest stable commit
|
||||||
.PHONY: nixpkgs
|
.PHONY: nixpkgs
|
||||||
|
@ -622,7 +622,7 @@ endef
|
||||||
.PHONY: .install.ginkgo
|
.PHONY: .install.ginkgo
|
||||||
.install.ginkgo: .gopathok
|
.install.ginkgo: .gopathok
|
||||||
if [ ! -x "$(GOBIN)/ginkgo" ]; then \
|
if [ ! -x "$(GOBIN)/ginkgo" ]; then \
|
||||||
$(GO_BUILD) -o ${GOPATH}/bin/ginkgo ./vendor/github.com/onsi/ginkgo/ginkgo ; \
|
$(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
.PHONY: .install.gitvalidation
|
.PHONY: .install.gitvalidation
|
||||||
|
|
Loading…
Reference in New Issue