@@ -229,7 +229,7 @@ LIBOBJS= @LIBOBJS@
229
229
PYTHON= python$(EXE)
230
230
BUILDPYTHON= python$(BUILDEXE)
231
231
232
- PYTHON_FOR_GEN=@PYTHON_FOR_GEN @
232
+ PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN @
233
233
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
234
234
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
235
235
BUILD_GNU_TYPE= @build@
@@ -273,11 +273,6 @@ IO_OBJS= \
273
273
Modules/_io/stringio.o
274
274
275
275
##########################################################################
276
- # Grammar
277
- GRAMMAR_H= Include/graminit.h
278
- GRAMMAR_C= Python/graminit.c
279
- GRAMMAR_INPUT= $(srcdir)/Grammar/Grammar
280
-
281
276
282
277
LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
283
278
@@ -316,38 +311,9 @@ PARSER_HEADERS= \
316
311
317
312
PGENOBJS= $(POBJS) $(PGOBJS)
318
313
319
- ##########################################################################
320
- # opcode.h generation
321
- OPCODE_H_DIR= $(srcdir)/Include
322
- OPCODE_H_SCRIPT= $(srcdir)/Tools/scripts/generate_opcode_h.py
323
- OPCODE_H= $(OPCODE_H_DIR)/opcode.h
324
- OPCODE_H_GEN= $(PYTHON_FOR_GEN) $(OPCODE_H_SCRIPT) $(srcdir)/Lib/opcode.py $(OPCODE_H)
325
-
326
- ##########################################################################
327
- # AST
328
- AST_H_DIR= Include
329
- AST_H= $(AST_H_DIR)/Python-ast.h
330
- AST_C_DIR= Python
331
- AST_C= $(AST_C_DIR)/Python-ast.c
332
- AST_ASDL= $(srcdir)/Parser/Python.asdl
333
-
334
- ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
335
- # Note that a build now requires Python to exist before the build starts.
336
- # Use "hg touch" to fix up screwed up file mtimes in a checkout.
337
- ASDLGEN= $(PYTHON_FOR_GEN) $(srcdir)/Parser/asdl_c.py
338
-
339
314
##########################################################################
340
315
# Python
341
316
342
- OPCODETARGETS_H= \
343
- Python/opcode_targets.h
344
-
345
- OPCODETARGETGEN= \
346
- $(srcdir)/Python/makeopcodetargets.py
347
-
348
- OPCODETARGETGEN_FILES= \
349
- $(OPCODETARGETGEN) $(srcdir)/Lib/opcode.py
350
-
351
317
PYTHON_OBJS= \
352
318
Python/_warnings.o \
353
319
Python/Python-ast.o \
@@ -548,11 +514,8 @@ coverage-lcov:
548
514
@echo "lcov report at $(COVERAGE_REPORT)/index.html"
549
515
@echo
550
516
551
- coverage-report:
552
- @ # force rebuilding of parser and importlib
553
- @touch $(GRAMMAR_INPUT)
554
- @touch $(srcdir)/Lib/importlib/_bootstrap.py
555
- @touch $(srcdir)/Lib/importlib/_bootstrap_external.py
517
+ # Force regeneration of parser and importlib
518
+ coverage-report: regen-grammar regen-importlib
556
519
@ # build with coverage info
557
520
$(MAKE) coverage
558
521
@ # run tests, ignore failures
@@ -724,14 +687,24 @@ Programs/_freeze_importlib.o: Programs/_freeze_importlib.c Makefile
724
687
Programs/_freeze_importlib: Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
725
688
$(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
726
689
727
- Python/importlib_external.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib Python/marshal.c
690
+ .PHONY: regen-importlib
691
+ regen-importlib: Programs/_freeze_importlib
692
+ # Regenerate Python/importlib_external.h
693
+ # from Lib/importlib/_bootstrap_external.py using _freeze_importlib
728
694
./Programs/_freeze_importlib \
729
- $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h
730
-
731
- Python/importlib.h: @GENERATED_COMMENT@ $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib Python/marshal.c
695
+ $(srcdir)/Lib/importlib/_bootstrap_external.py \
696
+ $(srcdir)/Python/importlib_external.h
697
+ # Regenerate Python/importlib.h from Lib/importlib/_bootstrap.py
698
+ # using _freeze_importlib
732
699
./Programs/_freeze_importlib \
733
- $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
700
+ $(srcdir)/Lib/importlib/_bootstrap.py \
701
+ $(srcdir)/Python/importlib.h
702
+
703
+
704
+ ############################################################################
705
+ # Regenerate all generated files
734
706
707
+ regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-ast regen-importlib
735
708
736
709
############################################################################
737
710
# Special rules for object files
@@ -790,15 +763,18 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
790
763
791
764
$(IO_OBJS): $(IO_H)
792
765
793
- $(GRAMMAR_H): @GENERATED_COMMENT@ $(GRAMMAR_INPUT) $(PGEN)
794
- @$(MKDIR_P) Include
795
- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
796
- $(GRAMMAR_C): @GENERATED_COMMENT@ $(GRAMMAR_H)
797
- touch $(GRAMMAR_C)
798
-
799
766
$(PGEN): $(PGENOBJS)
800
767
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
801
768
769
+ .PHONY: regen-grammar
770
+ regen-grammar: $(PGEN)
771
+ # Regenerate Include/graminit.h and Python/graminit.c
772
+ # from Grammar/Grammar using pgen
773
+ @$(MKDIR_P) Include
774
+ $(PGEN) $(srcdir)/Grammar/Grammar \
775
+ $(srcdir)/Include/graminit.h \
776
+ $(srcdir)/Python/graminit.c
777
+
802
778
Parser/grammar.o: $(srcdir)/Parser/grammar.c \
803
779
$(srcdir)/Include/token.h \
804
780
$(srcdir)/Include/grammar.h
@@ -810,18 +786,28 @@ Parser/printgrammar.o: $(srcdir)/Parser/printgrammar.c
810
786
811
787
Parser/pgenmain.o: $(srcdir)/Include/parsetok.h
812
788
813
- $(AST_H): $(AST_ASDL) $(ASDLGEN_FILES)
814
- $(MKDIR_P) $(AST_H_DIR)
815
- $(ASDLGEN) -h $(AST_H_DIR) $(AST_ASDL)
816
-
817
- $(AST_C): $(AST_H) $(AST_ASDL) $(ASDLGEN_FILES)
818
- $(MKDIR_P) $(AST_C_DIR)
819
- $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL)
820
-
821
- $(OPCODE_H): $(srcdir)/Lib/opcode.py $(OPCODE_H_SCRIPT)
822
- $(OPCODE_H_GEN)
823
-
824
- Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H)
789
+ .PHONY=regen-ast
790
+ regen-ast:
791
+ # Regenerate Include/Python-ast.h using Parser/asdl_c.py -h
792
+ $(MKDIR_P) $(srcdir)/Include
793
+ $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
794
+ -h $(srcdir)/Include \
795
+ $(srcdir)/Parser/Python.asdl
796
+ # Regenerate Python/Python-ast.c using Parser/asdl_c.py -c
797
+ $(MKDIR_P) $(srcdir)/Python
798
+ $(PYTHON_FOR_REGEN) $(srcdir)/Parser/asdl_c.py \
799
+ -c $(srcdir)/Python \
800
+ $(srcdir)/Parser/Python.asdl
801
+
802
+ .PHONY: regen-opcode
803
+ regen-opcode:
804
+ # Regenerate Include/opcode.h from Lib/opcode.py
805
+ # using Tools/scripts/generate_opcode_h.py
806
+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/generate_opcode_h.py \
807
+ $(srcdir)/Lib/opcode.py \
808
+ $(srcdir)/Include/opcode.h
809
+
810
+ Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
825
811
826
812
Python/getplatform.o: $(srcdir)/Python/getplatform.c
827
813
$(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
@@ -871,12 +857,16 @@ Objects/odictobject.o: $(srcdir)/Objects/dict-common.h
871
857
Objects/dictobject.o: $(srcdir)/Objects/stringlib/eq.h $(srcdir)/Objects/dict-common.h
872
858
Objects/setobject.o: $(srcdir)/Objects/stringlib/eq.h
873
859
874
- $(OPCODETARGETS_H): $(OPCODETARGETGEN_FILES)
875
- $(PYTHON_FOR_GEN) $(OPCODETARGETGEN) $(OPCODETARGETS_H)
860
+ .PHONY: regen-opcode-targets
861
+ regen-opcode-targets:
862
+ # Regenerate Python/opcode_targets.h from Lib/opcode.py
863
+ # using Python/makeopcodetargets.py
864
+ $(PYTHON_FOR_REGEN) $(srcdir)/Python/makeopcodetargets.py \
865
+ $(srcdir)/Python/opcode_targets.h
876
866
877
- Python/ceval.o: $(OPCODETARGETS_H) $(srcdir)/Python/ceval_gil.h
867
+ Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/ceval_gil.h
878
868
879
- Python/frozen.o: Python/importlib.h Python/importlib_external.h
869
+ Python/frozen.o: $(srcdir)/ Python/importlib.h $(srcdir)/ Python/importlib_external.h
880
870
881
871
# Generate DTrace probe macros, then rename them (PYTHON_ -> PyDTrace_) to
882
872
# follow our naming conventions. dtrace(1) uses the output filename to generate
@@ -891,8 +881,14 @@ Python/pydtrace.o: $(srcdir)/Include/pydtrace.d $(DTRACE_DEPS)
891
881
$(DTRACE) $(DFLAGS) -o $@ -G -s $< $(DTRACE_DEPS)
892
882
893
883
Objects/typeobject.o: Objects/typeslots.inc
894
- Objects/typeslots.inc: $(srcdir)/Include/typeslots.h $(srcdir)/Objects/typeslots.py
895
- $(PYTHON_FOR_GEN) $(srcdir)/Objects/typeslots.py < $(srcdir)/Include/typeslots.h Objects/typeslots.inc
884
+
885
+ .PHONY: regen-typeslots
886
+ regen-typeslots:
887
+ # Regenerate Objects/typeslots.inc from Include/typeslotsh
888
+ # using Objects/typeslots.py
889
+ $(PYTHON_FOR_REGEN) $(srcdir)/Objects/typeslots.py \
890
+ < $(srcdir)/Include/typeslots.h \
891
+ $(srcdir)/Objects/typeslots.inc
896
892
897
893
############################################################################
898
894
# Header files
@@ -945,7 +941,7 @@ PYTHON_HEADERS= \
945
941
$(srcdir)/Include/node.h \
946
942
$(srcdir)/Include/object.h \
947
943
$(srcdir)/Include/objimpl.h \
948
- $(OPCODE_H) \
944
+ $(srcdir)/Include/opcode.h \
949
945
$(srcdir)/Include/osdefs.h \
950
946
$(srcdir)/Include/osmodule.h \
951
947
$(srcdir)/Include/patchlevel.h \
@@ -988,7 +984,7 @@ PYTHON_HEADERS= \
988
984
$(srcdir)/Include/weakrefobject.h \
989
985
pyconfig.h \
990
986
$(PARSER_HEADERS) \
991
- $(AST_H) \
987
+ $(srcdir)/Include/Python-ast.h \
992
988
$(DTRACE_HEADERS)
993
989
994
990
$(LIBRARY_OBJS) $(MODOBJS) Programs/python.o: $(PYTHON_HEADERS)
@@ -1555,9 +1551,12 @@ recheck:
1555
1551
$(SHELL) config.status --recheck
1556
1552
$(SHELL) config.status
1557
1553
1558
- # Rebuild the configure script from configure.ac; also rebuild pyconfig.h.in
1554
+ # Regenerate configure and pyconfig.h.in
1555
+ .PHONY: autoconf
1559
1556
autoconf:
1557
+ # Regenerate the configure script from configure.ac using autoconf
1560
1558
(cd $(srcdir); autoconf -Wall)
1559
+ # Regenerate pyconfig.h.in from configure.ac using autoheader
1561
1560
(cd $(srcdir); autoheader -Wall)
1562
1561
1563
1562
# Create a tags file for vi
@@ -1574,14 +1573,6 @@ TAGS::
1574
1573
etags Include/*.h; \
1575
1574
for i in $(SRCDIRS); do etags -a $$i/*.[ch]; done
1576
1575
1577
- # This fixes up the mtimes of checked-in generated files, assuming that they
1578
- # only *appear* to be outdated because of checkout order.
1579
- # This is run while preparing a source release tarball, and can be run manually
1580
- # to avoid bootstrap issues.
1581
- touch:
1582
- cd $(srcdir); \
1583
- hg --config extensions.touch=Tools/hg/hgtouch.py touch -v
1584
D569
-
1585
1576
# Sanitation targets -- clean leaves libraries, executables and tags
1586
1577
# files, which clobber removes as well
1587
1578
pycremoval:
@@ -1699,7 +1690,7 @@ Python/thread.o: @THREADHEADERS@
1699
1690
.PHONY: maninstall libinstall inclinstall libainstall sharedinstall
1700
1691
.PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
1701
1692
.PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools
1702
- .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean
1693
+ .PHONY: frameworkaltinstallunixtools recheck clean clobber distclean
1703
1694
.PHONY: smelly funny patchcheck touch altmaninstall commoninstall
1704
1695
.PHONY: gdbhooks
1705
1696
0 commit comments