From ac228b9a1ad5b01612980de7f58ba1fef75d930c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 28 Apr 1997 00:22:02 +0000 Subject: [PATCH] got rid of interlock --- ChangeLog | 11 +++++++ Makefile.am | 4 +-- Makefile.in | 12 +++---- TODO | 4 +++ automake.in | 30 ++++++++---------- automake.texi | 10 +++--- interlock | 45 -------------------------- lib/am/Makefile.am | 4 +-- lib/ylwrap | 79 ++++++++++++++++++++++++++++++++-------------- ylwrap | 79 ++++++++++++++++++++++++++++++++-------------- 10 files changed, 156 insertions(+), 122 deletions(-) delete mode 100755 interlock diff --git a/ChangeLog b/ChangeLog index 5418d7db..c8344f9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ Sun Apr 27 11:03:36 1997 Tom Tromey + * automake.in (handle_yacc_lex_cxx): Don't use interlock. + (output_yacc_build_rule): Don't use interlock; just use new ylwrap + instead. + (output_lex_build_rule): Likewise. + (initialize_global_constants): [common_files] Don't include + interlock. + + * Makefile.am (pkgdata_SCRIPTS): Removed interlock. + * interlock: Removed. + * ylwrap: Changed interface. Now runs command in subdir. + * remake.am (config.status): Look in srcdir for config header. ($(srcdir)/configure): Likewise. * remake-hdr.am (@STAMP@): Look in srcdir for config header. From diff --git a/Makefile.am b/Makefile.am index 49d04d7f..f3376bb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,8 +18,8 @@ progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ ansi2knr.1 lisp.am lisp-clean.am ## These must all be executable when installed. -pkgdata_SCRIPTS = config.guess config.sub install-sh interlock \ -mdate-sh missing mkinstalldirs elisp-comp ylwrap acinstall +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ +mkinstalldirs elisp-comp ylwrap acinstall EXTRA_DIST = acinstall $(pkgdata_DATA) diff --git a/Makefile.in b/Makefile.in index b4e0ebf7..38dacf60 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,8 +76,8 @@ tags-clean.am texi-vers.am texinfos.am libs-clean.am ltlib-clean.am \ progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ ansi2knr.1 lisp.am lisp-clean.am -pkgdata_SCRIPTS = config.guess config.sub install-sh interlock \ -mdate-sh missing mkinstalldirs elisp-comp ylwrap acinstall +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ +mkinstalldirs elisp-comp ylwrap acinstall EXTRA_DIST = acinstall $(pkgdata_DATA) @@ -100,8 +100,8 @@ DATA = $(pkgdata_DATA) DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ Makefile.in NEWS README-alpha THANKS TODO aclocal.in aclocal.m4 \ ansi2knr.1 ansi2knr.c automake.in config.guess config.sub configure \ -configure.in elisp-comp install-sh interlock mdate-sh missing \ -mkinstalldirs stamp-vti texinfo.tex version.texi ylwrap +configure.in elisp-comp install-sh mdate-sh missing mkinstalldirs \ +stamp-vti texinfo.tex version.texi ylwrap DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) @@ -110,7 +110,7 @@ GZIP = --best default: all .SUFFIXES: -.SUFFIXES: .dvi .info .ps .texi .texinfo +.SUFFIXES: .texi .texinfo .info .dvi .ps $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --gnits Makefile @@ -411,7 +411,7 @@ dvi: $(DVIS) dvi-recursive check: all-am $(MAKE) check-recursive installcheck: installcheck-recursive installcheck-local -all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA) +all-am: $(INFO_DEPS) $(SCRIPTS) $(DATA) Makefile install-exec-am: install-binSCRIPTS diff --git a/TODO b/TODO index b3b9d5d9..b7eef500 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,10 @@ * update text in missing avoid passive voice +* if `interlock' exists, that should be an error (?) + should also warn about using new ylwrap and not old one + only do this when looking for ylwrap + ** make sure every variable that is used is also defined * make sure `missing' defines are generated diff --git a/automake.in b/automake.in index 47c56f14..76704f55 100755 --- a/automake.in +++ b/automake.in @@ -845,18 +845,16 @@ sub handle_yacc_lex_cxx if ($yacc_count > 1 || $lex_count > 1) { # If there is more than one distinct yacc (resp lex) source - # file in a given directory, then the `interlock' program is + # file in a given directory, then the `ylwrap' program is # required to allow parallel builds to work correctly. FIXME: # for now, no line number. - &require_config_file ($FOREIGN, 'interlock', 'ylwrap'); + &require_config_file ($FOREIGN, 'ylwrap'); if ($config_aux_dir ne '.' && $config_aux_dir ne '') { - &define_variable ('INTERLOCK', $config_aux_dir . "/interlock"); &define_variable ('YLWRAP', $config_aux_dir . "/ylwrap"); } else { - &define_variable ('INTERLOCK', '$(srcdir)/interlock'); &define_variable ('YLWRAP', '$(srcdir)/ylwrap'); } } @@ -953,7 +951,7 @@ sub handle_yacc_lex_cxx # compiled with C or C++, depending on the extension of the YACC file. sub output_yacc_build_rule { - local ($yacc_suffix, $use_interlock, $c_suffix) = @_; + local ($yacc_suffix, $use_ylwrap, $c_suffix) = @_; local ($c_suffix, $suffix); ($c_suffix = $yacc_suffix) =~ tr/y/c/; @@ -965,11 +963,11 @@ sub output_yacc_build_rule { $output_rules .= "$yacc_suffix$suffix:\n\t"; - if ($use_interlock) + if ($use_ylwrap) { - $output_rules .= ('$(SHELL) $(INTERLOCK) =yacclockdir $(YLWRAP)' - . ' "$(YACC)" y.tab.c $*' . $suffix - . ' y.tab.h $*.h -- $(YFLAGS) $<'); + $output_rules .= ('$(SHELL) $(YLWRAP)' + . ' "$(YACC)" $< y.tab.c $*' . $suffix + . ' y.tab.h $*.h -- $(YFLAGS)'); } else { @@ -984,7 +982,7 @@ sub output_yacc_build_rule sub output_lex_build_rule { - local ($lex_suffix, $use_interlock) = @_; + local ($lex_suffix, $use_ylwrap) = @_; local ($c_suffix); ($c_suffix = $lex_suffix) =~ tr/l/c/; @@ -993,12 +991,12 @@ sub output_lex_build_rule &define_configure_variable ('LEXLIB'); $output_rules .= "$lex_suffix$c_suffix:\n\t"; - if ($use_interlock) + if ($use_ylwrap) { - # is the $@ correct here? If so, why not use it in the - # interlock build rule for yacc above? - $output_rules .= '$(SHELL) $(INTERLOCK) =lexlockdir $(YLWRAP)' - . ' "$(LEX)" $(LEX_OUTPUT_ROOT).c $@ -- $(LFLAGS) $<'; + # Is the $@ correct here? If so, why not use it in the ylwrap + # build rule for yacc above? + $output_rules .= '$(SHELL) $(YLWRAP)' + . ' "$(LEX)" $< $(LEX_OUTPUT_ROOT).c $@ -- $(LFLAGS)'; } else { @@ -4574,7 +4572,7 @@ sub initialize_global_constants "config.guess", "config.sub", "AUTHORS", "BACKLOG", "ABOUT-GNU", "libversion.in", "mdate-sh", "mkinstalldirs", "install-sh", 'texinfo.tex', "ansi2knr.c", "ansi2knr.1", 'elisp-comp', - 'interlock', 'ylwrap', 'acinclude.m4', @libtoolize_files, + 'ylwrap', 'acinclude.m4', @libtoolize_files, 'missing' ); diff --git a/automake.texi b/automake.texi index 4d5f45a3..f0b91c6f 100644 --- a/automake.texi +++ b/automake.texi @@ -1457,13 +1457,13 @@ the appropriate @samp{LDADD} variable. Automake makes it possible to include multiple yacc (or lex) source files in a single program. Automake uses a small program called -@code{interlock} to manage locks between multiple yacc invocations. +@code{ylwrap} to run @code{yacc} (or @code{lex}) in a subdirectory. This is necessary because yacc's output filename is fixed, and a parallel make could conceivably invoke more than one instance of -@code{yacc} simultaneously. @code{interlock} is distributed with -automake. It should appear in the directory specified by -@samp{AC_CONFIG_AUX_DIR}, or the current directory if that macro is not -used in @file{configure.in}. +@code{yacc} simultaneously. @code{ylwrap} is distributed with automake. +It should appear in the directory specified by @samp{AC_CONFIG_AUX_DIR}, +or the current directory if that macro is not used in +@file{configure.in}. For @code{yacc}, simply managing locking is insufficient. @code{yacc} output also always uses the same symbol names internally, so it isn't diff --git a/interlock b/interlock deleted file mode 100755 index 88e27332..00000000 --- a/interlock +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -# interlock - wrap program invocation in lock to allow -# parallel builds to work. -# Written by Tom Tromey , Aug 10 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# Usage: -# interlock lock-dir-name program args-to-program... - -dirname="$1" -program="$2" - -shift -shift - -while (mkdir $dirname > /dev/null 2>&1 && exit 1 || exit 0); do - # Wait a bit. - sleep 1 -done - -# Race condition here: if interrupted after the loop but before this -# trap, the lock can be left around. -trap "rmdir $dirname > /dev/null 2>&1" 1 2 3 15 - -# We have the lock, so run the program. -$program ${1+"$@"} -ret=$? - -# Release the lock. -rmdir $dirname > /dev/null 2>&1 - -exit $ret diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 49d04d7f..f3376bb8 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -18,8 +18,8 @@ progs-clean.am data-clean.am COPYING INSTALL texinfo.tex ansi2knr.c \ ansi2knr.1 lisp.am lisp-clean.am ## These must all be executable when installed. -pkgdata_SCRIPTS = config.guess config.sub install-sh interlock \ -mdate-sh missing mkinstalldirs elisp-comp ylwrap acinstall +pkgdata_SCRIPTS = config.guess config.sub install-sh mdate-sh missing \ +mkinstalldirs elisp-comp ylwrap acinstall EXTRA_DIST = acinstall $(pkgdata_DATA) diff --git a/lib/ylwrap b/lib/ylwrap index 5b47e055..d74184c1 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -1,6 +1,7 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -# Written by Tom Tromey , Aug 11 1996 +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,8 +18,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Usage: -# ylwrap PROG [OUTPUT DESIRED]... -- [ARGS]... -# * PROG is program to run. +# ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]... +# * PROGRAM is program to run. +# * INPUT is the input file # * OUTPUT is file PROG generates # * DESIRED is file we actually want # * ARGS are passed to PROG @@ -28,6 +30,21 @@ prog="$1" shift +# The input. +input="$1" +shift +case "$input" in + /*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. Why? Because otherwise any + # debugging info in the generated file will point to the wrong + # place. This is really gross. + input="`pwd`/$input" + ;; +esac + pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then @@ -37,26 +54,42 @@ while test "$#" -ne 0; do shift done -$prog ${1+"$@"} || exit $? +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 -set X $pairlist -shift -status=0 -first=yes -while test "$#" -ne 0; do - if test -f "$1"; then - mv "$1" "$2" || status=$? - else - # A missing file is only an error for the first file. This is a - # blatant hack to let us support using "yacc -d". If -d is not - # specified, we don't want an error when the header file is - # "missing". - if test $first = yes; then - status=1 - fi - fi - shift +cd $dirname +"$prog" ${1+"$@"} "$input" +status=$? + +if test $status -eq 0; then + set X $pairlist shift - first=no -done + first=yes + while test "$#" -ne 0; do + if test -f "$1"; then + mv "$1" "../$2" || status=$? + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + status=1 + fi + fi + shift + shift + first=no + done +else + status=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + exit $status diff --git a/ylwrap b/ylwrap index 5b47e055..d74184c1 100755 --- a/ylwrap +++ b/ylwrap @@ -1,6 +1,7 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -# Written by Tom Tromey , Aug 11 1996 +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,8 +18,9 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Usage: -# ylwrap PROG [OUTPUT DESIRED]... -- [ARGS]... -# * PROG is program to run. +# ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]... +# * PROGRAM is program to run. +# * INPUT is the input file # * OUTPUT is file PROG generates # * DESIRED is file we actually want # * ARGS are passed to PROG @@ -28,6 +30,21 @@ prog="$1" shift +# The input. +input="$1" +shift +case "$input" in + /*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. Why? Because otherwise any + # debugging info in the generated file will point to the wrong + # place. This is really gross. + input="`pwd`/$input" + ;; +esac + pairlist= while test "$#" -ne 0; do if test "$1" = "--"; then @@ -37,26 +54,42 @@ while test "$#" -ne 0; do shift done -$prog ${1+"$@"} || exit $? +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 -set X $pairlist -shift -status=0 -first=yes -while test "$#" -ne 0; do - if test -f "$1"; then - mv "$1" "$2" || status=$? - else - # A missing file is only an error for the first file. This is a - # blatant hack to let us support using "yacc -d". If -d is not - # specified, we don't want an error when the header file is - # "missing". - if test $first = yes; then - status=1 - fi - fi - shift +cd $dirname +"$prog" ${1+"$@"} "$input" +status=$? + +if test $status -eq 0; then + set X $pairlist shift - first=no -done + first=yes + while test "$#" -ne 0; do + if test -f "$1"; then + mv "$1" "../$2" || status=$? + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + status=1 + fi + fi + shift + shift + first=no + done +else + status=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + exit $status -- 2.43.5