From 5868836ea1527d1da164eae38b0b6cb8ae481cad Mon Sep 17 00:00:00 2001 From: Peter Mattis Date: Fri, 29 May 2020 09:58:57 -0400 Subject: [PATCH] Makefile: fix handling of non-existent *.eg.go files When a `bin/*.d` file references an `*.eg.go` file, that file was required to exist or be buildable by the Makefile. Any commit which removed a `*.eg.go` file would violate this requirement causing the build to fail until the offending `bin/*.d` file was removed. In order to prevent this badness, a catchall `%.eg.go` rule is added which will force the target dependent on the `bin/%.d` file to be rebuilt. Fixes #49676 Release note: None --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cd870594f5a7..1bb5619c8567 100644 --- a/Makefile +++ b/Makefile @@ -1558,7 +1558,7 @@ endif # to the present, because then it will becomes newer # than all the other produced artifacts downstream and force # them to rebuild too. -%.eg.go: bin/execgen +$(EXECGEN_TARGETS): bin/execgen @echo EXECGEN $@ @execgen $@ > $@.tmp || { rm -f $@.tmp; exit 1; } @cmp $@.tmp $@ 2>/dev/null && rm -f $@.tmp || mv -f $@.tmp $@ @@ -1570,6 +1570,12 @@ endif fi; \ touch -r $$target_timestamp_file $@ +# Add a catch-all rule for any non-existent execgen generated +# files. This prevents build errors when switching between branches +# that introduce or remove execgen generated files as these files are +# persisted in bin/%.d dependency lists (e.g. in bin/logictest.d). +%.eg.go: ; + optgen-defs := pkg/sql/opt/ops/*.opt optgen-norm-rules := pkg/sql/opt/norm/rules/*.opt optgen-xform-rules := pkg/sql/opt/xform/rules/*.opt