@@ -230,6 +230,7 @@ PYTHON= python$(EXE)
230230BUILDPYTHON= python$(BUILDEXE)
231231
232232PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
233+ UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
233234PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
234235_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
235236BUILD_GNU_TYPE= @build@
@@ -696,12 +697,14 @@ regen-importlib: Programs/_freeze_importlib
696697 # from Lib/importlib/_bootstrap_external.py using _freeze_importlib
697698 ./Programs/_freeze_importlib \
698699 $(srcdir)/Lib/importlib/_bootstrap_external.py \
699- $(srcdir)/Python/importlib_external.h
700+ $(srcdir)/Python/importlib_external.h.new
701+ $(UPDATE_FILE) $(srcdir)/Python/importlib_external.h $(srcdir)/Python/importlib_external.h.new
700702 # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
701703 # using _freeze_importlib
702704 ./Programs/_freeze_importlib \
703705 $(srcdir)/Lib/importlib/_bootstrap.py \
704- $(srcdir)/Python/importlib.h
706+ $(srcdir)/Python/importlib.h.new
707+ $(UPDATE_FILE) $(srcdir)/Python/importlib.h $(srcdir)/Python/importlib.h.new
705708
706709
707710############################################################################
@@ -775,8 +778,10 @@ regen-grammar: $(PGEN)
775778 # from Grammar/Grammar using pgen
776779 @$(MKDIR_P) Include
777780 $(PGEN) $(srcdir)/Grammar/Grammar \
778- $(srcdir)/Include/graminit.h \
779- $(srcdir)/Python/graminit.c
781+ $(srcdir)/Include/graminit.h.new \
782+ $(srcdir)/Python/graminit.c.new
783+ $(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new
784+ $(UPDATE_FILE) $(srcdir)/Python/graminit.c $(srcdir)/Python/graminit.c.new
780785
781786Parser/grammar.o: $(srcdir)/Parser/grammar.c \
782787 $(srcdir)/Include/token.h \
@@ -794,21 +799,24 @@ regen-ast:
794799 # Regenerate Include/Python-ast.h using Parser/asdl_c.py -h
795800 $(MKDIR_P) $(srcdir)/Include
796801 $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
797- -h $(srcdir)/Include \
802+ -h $(srcdir)/Include/Python-ast.h.new \
798803 $(srcdir)/Parser/Python.asdl
804+ $(UPDATE_FILE) $(srcdir)/Include/Python-ast.h $(srcdir)/Include/Python-ast.h.new
799805 # Regenerate Python/Python-ast.c using Parser/asdl_c.py -c
800806 $(MKDIR_P) $(srcdir)/Python
801807 $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
802- -c $(srcdir)/Python \
808+ -c $(srcdir)/Python/Python-ast.c.new \
803809 $(srcdir)/Parser/Python.asdl
810+ $(UPDATE_FILE) $(srcdir)/Python/Python-ast.c $(srcdir)/Python/Python-ast.c.new
804811
805812.PHONY: regen-opcode
806813regen-opcode:
807814 # Regenerate Include/opcode.h from Lib/opcode.py
808815 # using Tools/scripts/generate_opcode_h.py
809816 $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \
810817 $(srcdir)/Lib/opcode.py \
811- $(srcdir)/Include/opcode.h
818+ $(srcdir)/Include/opcode.h.new
819+ $(UPDATE_FILE) $(srcdir)/Include/opcode.h $(srcdir)/Include/opcode.h.new
812820
813821Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
814822
@@ -865,7 +873,8 @@ regen-opcode-targets:
865873 # Regenerate Python/opcode_targets.h from Lib/opcode.py
866874 # using Python/makeopcodetargets.py
867875 $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
868- $(srcdir)/Python/opcode_targets.h
876+ $(srcdir)/Python/opcode_targets.h.new
877+ $(UPDATE_FILE) $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/opcode_targets.h.new
869878
870879Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h
871880
@@ -892,7 +901,8 @@ regen-typeslots:
892901 # using Objects/typeslots.py
893902 $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \
894903 < $(srcdir)/Include/typeslots.h \
895- $(srcdir)/Objects/typeslots.inc
904+ $(srcdir)/Objects/typeslots.inc.new
905+ $(UPDATE_FILE) $(srcdir)/Objects/typeslots.inc $(srcdir)/Objects/typeslots.inc.new
896906
897907############################################################################
898908# Header files
0 commit comments