mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #108376 from thockin/makefile-static-nonstatic-output
Makefile: clean up static/nonstatic build output
This commit is contained in:
commit
8b46a0d276
@ -67,7 +67,8 @@ $(META_DIR)/$(GO_PKGDEPS_FILE): FORCE
|
|||||||
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
|
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
|
||||||
echo "DBG: calculating Go dependencies"; \
|
echo "DBG: calculating Go dependencies"; \
|
||||||
fi
|
fi
|
||||||
hack/run-in-gopath.sh go install ./hack/make-rules/helpers/go2make
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh hack/make-rules/helpers/go2make
|
||||||
hack/run-in-gopath.sh go2make \
|
hack/run-in-gopath.sh go2make \
|
||||||
k8s.io/kubernetes/... \
|
k8s.io/kubernetes/... \
|
||||||
--prune k8s.io/kubernetes/staging \
|
--prune k8s.io/kubernetes/staging \
|
||||||
@ -205,7 +206,8 @@ $(PRERELEASE_LIFECYCLE_FILES): $(PRERELEASE_LIFECYCLE_GEN)
|
|||||||
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
||||||
# it, and make is happy.
|
# it, and make is happy.
|
||||||
$(PRERELEASE_LIFECYCLE_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen)
|
$(PRERELEASE_LIFECYCLE_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
@ -299,7 +301,8 @@ $(DEEPCOPY_FILES): $(DEEPCOPY_GEN)
|
|||||||
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
||||||
# it, and make is happy.
|
# it, and make is happy.
|
||||||
$(DEEPCOPY_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/deepcopy-gen)
|
$(DEEPCOPY_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/deepcopy-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh vendor/k8s.io/code-generator/cmd/deepcopy-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
@ -399,7 +402,8 @@ $(DEFAULTER_FILES): $(DEFAULTER_GEN)
|
|||||||
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
||||||
# it, and make is happy.
|
# it, and make is happy.
|
||||||
$(DEFAULTER_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/defaulter-gen)
|
$(DEFAULTER_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/defaulter-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/defaulter-gen
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh vendor/k8s.io/code-generator/cmd/defaulter-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
@ -512,7 +516,8 @@ $(CONVERSION_FILES): $(CONVERSION_GEN)
|
|||||||
# newer than the binary, and try to rebuild it over and over. So we touch it,
|
# newer than the binary, and try to rebuild it over and over. So we touch it,
|
||||||
# and make is happy.
|
# and make is happy.
|
||||||
$(CONVERSION_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/conversion-gen)
|
$(CONVERSION_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/code-generator/cmd/conversion-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/conversion-gen
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh vendor/k8s.io/code-generator/cmd/conversion-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
|
|
||||||
@ -636,5 +641,6 @@ gen_openapi: $(OPENAPI_GEN) $(KUBE_OPENAPI_OUTFILE) $(AGGREGATOR_OPENAPI_OUTFILE
|
|||||||
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
# newer than the binary, and try to "rebuild" it over and over. So we touch
|
||||||
# it, and make is happy.
|
# it, and make is happy.
|
||||||
$(OPENAPI_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/kube-openapi/cmd/openapi-gen)
|
$(OPENAPI_GEN): $(GODEPS_k8s.io/kubernetes/vendor/k8s.io/kube-openapi/cmd/openapi-gen)
|
||||||
KUBE_BUILD_PLATFORMS="" hack/make-rules/build.sh ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
|
KUBE_BUILD_PLATFORMS="" \
|
||||||
|
hack/make-rules/build.sh vendor/k8s.io/kube-openapi/cmd/openapi-gen
|
||||||
touch $@
|
touch $@
|
||||||
|
@ -696,18 +696,21 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
local -a nonstatics=()
|
local -a nonstatics=()
|
||||||
local -a tests=()
|
local -a tests=()
|
||||||
|
|
||||||
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
|
|
||||||
|
|
||||||
for binary in "${binaries[@]}"; do
|
for binary in "${binaries[@]}"; do
|
||||||
if [[ "${binary}" =~ ".test"$ ]]; then
|
if [[ "${binary}" =~ ".test"$ ]]; then
|
||||||
tests+=("${binary}")
|
tests+=("${binary}")
|
||||||
|
kube::log::info " ${binary} (test)"
|
||||||
elif kube::golang::is_statically_linked_library "${binary}"; then
|
elif kube::golang::is_statically_linked_library "${binary}"; then
|
||||||
statics+=("${binary}")
|
statics+=("${binary}")
|
||||||
|
kube::log::info " ${binary} (static)"
|
||||||
else
|
else
|
||||||
nonstatics+=("${binary}")
|
nonstatics+=("${binary}")
|
||||||
|
kube::log::info " ${binary} (non-static)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
V=2 kube::log::info "Env for ${platform}: GOOS=${GOOS-} GOARCH=${GOARCH-} GOROOT=${GOROOT-} CGO_ENABLED=${CGO_ENABLED-} CC=${CC-}"
|
||||||
|
|
||||||
local -a build_args
|
local -a build_args
|
||||||
if [[ "${#statics[@]}" != 0 ]]; then
|
if [[ "${#statics[@]}" != 0 ]]; then
|
||||||
build_args=(
|
build_args=(
|
||||||
@ -718,7 +721,6 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
-ldflags "${goldflags:-}"
|
-ldflags "${goldflags:-}"
|
||||||
-tags "${gotags:-}"
|
-tags "${gotags:-}"
|
||||||
)
|
)
|
||||||
V=1 kube::log::info "> static build CGO_ENABLED=0: ${statics[*]}"
|
|
||||||
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
|
CGO_ENABLED=0 kube::golang::build_some_binaries "${statics[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -730,7 +732,6 @@ kube::golang::build_binaries_for_platform() {
|
|||||||
-ldflags "${goldflags:-}"
|
-ldflags "${goldflags:-}"
|
||||||
-tags "${gotags:-}"
|
-tags "${gotags:-}"
|
||||||
)
|
)
|
||||||
V=1 kube::log::info "> non-static build: ${nonstatics[*]}"
|
|
||||||
kube::golang::build_some_binaries "${nonstatics[@]}"
|
kube::golang::build_some_binaries "${nonstatics[@]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -872,7 +873,7 @@ kube::golang::build_binaries() {
|
|||||||
exit "${fails}"
|
exit "${fails}"
|
||||||
else
|
else
|
||||||
for platform in "${platforms[@]}"; do
|
for platform in "${platforms[@]}"; do
|
||||||
kube::log::status "Building go targets for ${platform}:" "${targets[@]}"
|
kube::log::status "Building go targets for ${platform}"
|
||||||
(
|
(
|
||||||
kube::golang::set_platform_envs "${platform}"
|
kube::golang::set_platform_envs "${platform}"
|
||||||
kube::golang::build_binaries_for_platform "${platform}"
|
kube::golang::build_binaries_for_platform "${platform}"
|
||||||
|
Loading…
Reference in New Issue
Block a user