diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2020-12-18 16:46:09 +0100 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-01-14 11:54:57 -0500 |
commit | d498ef53aa71066aec7771ebb7316bf3eb3d4cde (patch) | |
tree | 674db8a9dcc318832c253a49cc46d709d8bde3bd /Makefile | |
parent | a944f906b8de00be0b50f9407d1905ba20f80823 (diff) | |
download | podman-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-- | Makefile | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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 \ |