Merge pull request #108377 from thockin/makefile-check-restarts

Makefile: avoid redundant work upon make restart
This commit is contained in:
Kubernetes Prow Robot 2022-02-27 13:25:17 -08:00 committed by GitHub
commit 6d7c252906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,11 @@ ifeq ($(MAKECMDGOALS),)
endif
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** starting Makefile.generated_files for goal(s) "$(MAKECMDGOALS)")
ifeq ($(MAKE_RESTARTS),)
$(warning ***** starting Makefile.generated_files for goal(s) "$(MAKECMDGOALS)")
else
$(warning ***** restarting Makefile.generated_files for goal(s) "$(MAKECMDGOALS)")
endif
$(warning ***** $(shell date))
endif
@ -59,6 +63,10 @@ GO_PKGDEPS_FILE = go-pkgdeps.mk
# reload the updated deps.
sinclude $(META_DIR)/$(GO_PKGDEPS_FILE)
# Only build and run go2make on the first pass. If that generates a new
# GO_PKGDEPS_FILE, make will restart the whole process and set MAKE_RESTARTS to
# a numeric value.
ifeq ($(MAKE_RESTARTS),)
# Update the set of Go deps for our project. This will let us determine if
# we really need to do expensive codegen. We use FORCE because it is not a
# PHONY file, but we do want it to be re-evaluated every time make is run. The
@ -82,6 +90,7 @@ $(META_DIR)/$(GO_PKGDEPS_FILE): FORCE
cat $@.tmp > $@; \
fi
rm -f $@.tmp
endif # MAKE_RESTARTS
.PHONY: FORCE
FORCE: