summaryrefslogtreecommitdiffstats
path: root/Makefile.pre.in
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2020-04-22 22:29:27 (GMT)
committerGitHub <noreply@github.com>2020-04-22 22:29:27 (GMT)
commitc5fc15685202cda73f7c3f5c6f299b0945f58508 (patch)
tree7624ae45b95f2812e801c5879bdbdcb796f570a6 /Makefile.pre.in
parenta81849b0315277bb3937271174aaaa5059c0b445 (diff)
downloadcpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.zip
cpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.tar.gz
cpython-c5fc15685202cda73f7c3f5c6f299b0945f58508.tar.bz2
bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)
Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Makefile.pre.in')
-rw-r--r--Makefile.pre.in26
1 files changed, 23 insertions, 3 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 4511e60..b34fa64 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -244,7 +244,7 @@ LIBOBJS= @LIBOBJS@
PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE)
-PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@
+PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@
UPDATE_FILE=@PYTHON_FOR_REGEN@ $(srcdir)/Tools/scripts/update_file.py
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
@@ -295,6 +295,19 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
##########################################################################
# Parser
+
+PEGEN_OBJS= \
+ Parser/pegen/pegen.o \
+ Parser/pegen/parse.o \
+ Parser/pegen/parse_string.o \
+ Parser/pegen/peg_api.o
+
+
+PEGEN_HEADERS= \
+ $(srcdir)/Include/pegen_interface.h \
+ $(srcdir)/Parser/pegen/pegen.h \
+ $(srcdir)/Parser/pegen/parse_string.h
+
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -303,9 +316,10 @@ POBJS= \
Parser/parser.o \
Parser/token.o \
-PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
+PARSER_OBJS= $(POBJS) $(PEGEN_OBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
PARSER_HEADERS= \
+ $(PEGEN_HEADERS) \
$(srcdir)/Include/grammar.h \
$(srcdir)/Include/parsetok.h \
$(srcdir)/Parser/parser.h \
@@ -731,7 +745,7 @@ regen-importlib: Programs/_freeze_importlib
############################################################################
# Regenerate all generated files
-regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar \
+regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-pegen \
regen-token regen-keyword regen-symbol regen-ast regen-importlib clinic
############################################################################
@@ -806,6 +820,12 @@ regen-grammar: regen-token
$(UPDATE_FILE) $(srcdir)/Include/graminit.h $(srcdir)/Include/graminit.h.new
$(UPDATE_FILE) $(srcdir)/Python/graminit.c $(srcdir)/Python/graminit.c.new
+.PHONY: regen-pegen
+regen-pegen:
+ PYTHONPATH=$(srcdir)/Tools/peg_generator $(PYTHON_FOR_REGEN) -m pegen -c -q $(srcdir)/Grammar/python.gram \
+ -o $(srcdir)/Parser/pegen/parse.new.c
+ $(UPDATE_FILE) $(srcdir)/Parser/pegen/parse.c $(srcdir)/Parser/pegen/parse.new.c
+
.PHONY=regen-ast
regen-ast:
# Regenerate Include/Python-ast.h using Parser/asdl_c.py -h