summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2012-03-15 17:08:34 (GMT)
committerMatthias Klose <doko@ubuntu.com>2012-03-15 17:08:34 (GMT)
commit93a0ef16c939581fb366897d2f07c395601f8ddf (patch)
treed7d4f64ed1af9a152dd341692dcb8353e4fecd71
parenta4e018889ac3537e10b48811b4be6356e633b8a0 (diff)
downloadcpython-93a0ef16c939581fb366897d2f07c395601f8ddf.zip
cpython-93a0ef16c939581fb366897d2f07c395601f8ddf.tar.gz
cpython-93a0ef16c939581fb366897d2f07c395601f8ddf.tar.bz2
- Issue #14321: Do not run pgen during the build if files are up to date.
-rw-r--r--Makefile.pre.in38
-rw-r--r--Misc/NEWS5
-rwxr-xr-xconfigure50
-rw-r--r--configure.ac1
4 files changed, 88 insertions, 6 deletions
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 31efeca..1321162 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -58,6 +58,8 @@ INSTALL_DATA= @INSTALL_DATA@
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED= ${INSTALL} -m 555
+MKDIR_P= @MKDIR_P@
+
MAKESETUP= $(srcdir)/Modules/makesetup
# Compiler options
@@ -233,6 +235,18 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
# Parser
PGEN= Parser/pgen$(EXE)
+PSRCS= \
+ Parser/acceler.c \
+ Parser/grammar1.c \
+ Parser/listnode.c \
+ Parser/node.c \
+ Parser/parser.c \
+ Parser/bitset.c \
+ Parser/metagrammar.c \
+ Parser/firstsets.c \
+ Parser/grammar.c \
+ Parser/pgen.c
+
POBJS= \
Parser/acceler.o \
Parser/grammar1.o \
@@ -247,6 +261,16 @@ POBJS= \
PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o
+PGSRCS= \
+ Objects/obmalloc.c \
+ Python/dynamic_annotations.c \
+ Python/mysnprintf.c \
+ Python/pyctype.c \
+ Parser/tokenizer_pgen.c \
+ Parser/printgrammar.c \
+ Parser/parsetok_pgen.c \
+ Parser/pgenmain.c
+
PGOBJS= \
Objects/obmalloc.o \
Python/dynamic_annotations.o \
@@ -262,7 +286,8 @@ PARSER_HEADERS= \
$(srcdir)/Include/parsetok.h \
$(srcdir)/Parser/tokenizer.h
-PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
+PGENSRCS= $(PSRCS) $(PGSRCS)
+PGENOBJS= $(POBJS) $(PGOBJS)
##########################################################################
# AST
@@ -591,12 +616,13 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile
$(IO_OBJS): $(IO_H)
-# Use a stamp file to prevent make -j invoking pgen twice
-$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
-Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
- -@$(INSTALL) -d Include
+$(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
+ @$(MKDIR_P) Include
+ $(MAKE) $(PGEN)
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
- -touch Parser/pgen.stamp
+$(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
+ $(MAKE) $(GRAMMAR_H)
+ touch $(GRAMMAR_C)
$(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
diff --git a/Misc/NEWS b/Misc/NEWS
index cb1ec6d..d41a2b4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -106,6 +106,11 @@ Library
- Issue #14210: pdb now has tab-completion not only for command names, but
also for their arguments, wherever possible.
+Build
+-----
+
+- Issue #14321: Do not run pgen during the build if files are up to date.
+
Extension Modules
-----------------
diff --git a/configure b/configure
index 7abf15b..a71e128 100755
--- a/configure
+++ b/configure
@@ -640,6 +640,7 @@ BASECFLAGS
OPT
ABIFLAGS
LN
+MKDIR_P
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
@@ -5382,6 +5383,48 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
# Not every filesystem supports hard links
@@ -14647,6 +14690,7 @@ gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
test -n "\$AWK" || AWK=awk
_ACEOF
@@ -15214,6 +15258,11 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
@@ -15268,6 +15317,7 @@ s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
diff --git a/configure.ac b/configure.ac
index 47ba787..a38a5cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -848,6 +848,7 @@ bsdos*|hp*|HP*)
fi
esac
AC_PROG_INSTALL
+AC_PROG_MKDIR_P
# Not every filesystem supports hard links
AC_SUBST(LN)