summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-12-18 16:46:09 +0100
committerDaniel J Walsh <dwalsh@redhat.com>2021-01-14 11:54:57 -0500
commitd498ef53aa71066aec7771ebb7316bf3eb3d4cde (patch)
tree674db8a9dcc318832c253a49cc46d709d8bde3bd /Makefile
parenta944f906b8de00be0b50f9407d1905ba20f80823 (diff)
downloadpodman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.tar.gz
podman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.tar.bz2
podman-d498ef53aa71066aec7771ebb7316bf3eb3d4cde.zip
Makefile: add target to generate bindings
Add a `.generate-bindings` make target that only runs in the absence of the `.generate-bindings` file or when a `types.go` file below `pkg/bindings` has changed. This will regenerate the go bindings and make sure the code is up2date. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 26 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 085af6d80..48c3431cd 100644
--- a/Makefile
+++ b/Makefile
@@ -198,7 +198,7 @@ endif
podman: bin/podman
.PHONY: bin/podman-remote
-bin/podman-remote: .gopathok $(SOURCES) go.mod go.sum ## Build with podman on remote environment
+bin/podman-remote: .gopathok .generate-bindings $(SOURCES) go.mod go.sum ## Build with podman on remote environment
$(GO) build $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "${REMOTETAGS}" -o $@ ./cmd/podman
.PHONY: bin/podman-remote-static
@@ -268,6 +268,8 @@ clean: ## Clean artifacts
libpod/pod_ffjson.go \
libpod/container_easyjson.go \
libpod/pod_easyjson.go \
+ .install.goimports \
+ .generate-bindings \
docs/build
make -C docs clean
@@ -407,7 +409,7 @@ release.txt:
# X-RELEASE-INFO format depended upon by automated tooling
echo -n "X-RELEASE-INFO:" > "$@"
for field in "$(RELEASE_BASENAME)" "$(RELEASE_VERSION)" \
- "$(RELEASE_DIST)" "$(RELEASE_DIST_VER)" "$(RELEASE_ARCH)"; do \
+ "$(RELEASE_DIST)" "$(RELEASE_DIST_VER)" "$(RELEASE_ARCH)"; do \
echo -n " $$field"; done >> "$@"
echo "" >> "$@"
@@ -449,6 +451,21 @@ podman-remote-%-release:
rm -f release.txt
$(MAKE) podman-remote-release-$*.zip
+BINDINGS_SOURCE = $(wildcard pkg/bindings/**/types.go)
+.generate-bindings: $(BINDINGS_SOURCE)
+ifneq ($(shell uname -s), Darwin)
+ for i in $(BINDINGS_SOURCE); do \
+ dirname=$$(dirname $${i}); \
+ shortname=$$(basename $${dirname}); \
+ pushd $${dirname}>/dev/null; \
+ echo $${dirname}; \
+ echo $(GO) generate; \
+ $(GO) generate; \
+ popd > /dev/null; \
+ done;
+endif
+ touch .generate-bindings
+
.PHONY: docker-docs
docker-docs: docs
(cd docs; ./dckrman.sh ./build/man/*.1)
@@ -565,13 +582,19 @@ uninstall:
GIT_CHECK_EXCLUDE="./vendor:docs/make.bat" $(GOBIN)/git-validation -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
.PHONY: install.tools
-install.tools: .install.gitvalidation .install.md2man .install.ginkgo .install.golangci-lint .install.bats ## Install needed tools
+install.tools: .install.goimports .install.gitvalidation .install.md2man .install.ginkgo .install.golangci-lint .install.bats ## Install needed tools
define go-get
env GO111MODULE=off \
$(GO) get -u ${1}
endef
+.install.goimports: .gopathok
+ if [ ! -x "$(GOBIN)/goimports" ]; then \
+ $(call go-get,golang.org/x/tools/cmd/goimports); \
+ fi
+ touch .install.goimports
+
.PHONY: .install.ginkgo
.install.ginkgo: .gopathok
if [ ! -x "$(GOBIN)/ginkgo" ]; then \