]> sourceware.org Git - automake.git/commitdiff
* automake.in (&condition_negate): New.
authorAkim Demaille <akim@epita.fr>
Mon, 9 Apr 2001 09:58:56 +0000 (09:58 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 9 Apr 2001 09:58:56 +0000 (09:58 +0000)
(&variable_conditions_permutations): Use it.
(&read_am_file, &file_contents): Use it on `else' clauses to
support `if FALSE'.
(&output_yacc_build_rule): Output this...
* yacc.am: New file.

ChangeLog
Makefile.am
Makefile.in
automake.in
lib/am/Makefile.am
lib/am/yacc.am [new file with mode: 0644]
yacc.am [new file with mode: 0644]

index 05306fc070012a2a0e4258f9585e5069a907eb02..c4eb82e5ed0de9d4911f9b91f99759d7978059c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-04-09  Akim Demaille  <akim@epita.fr>
+
+       * automake.in (&condition_negate): New.
+       (&variable_conditions_permutations): Use it.
+       (&read_am_file, &file_contents): Use it on `else' clauses to
+       support `if FALSE'.
+       (&output_yacc_build_rule): Output this...
+       * yacc.am: New file.
+
 2001-04-09  Akim Demaille  <akim@epita.fr>
 
        * automake.in (&make_paragraphs): Transform TOPDIR_P and TOPDIR.
index 8da2d3dac260a5b7284652af51c8237d16f1d4bb..ba257991a00652a7172bd9f2824751411f9bf832 100644 (file)
@@ -16,7 +16,7 @@ distdir.am footer.am header-vars.am header.am install.am java.am  \
 kr-extra.am library.am libs.am libtool.am lisp.am ltlib.am       \
 ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
 python.am remake-hdr.am remake.am scripts.am subdirs.am tags.am          \
-texi-vers.am texibuild.am texinfos.am
+texi-vers.am texibuild.am texinfos.am yacc.am
 
 dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
 $(amfiles)
index de98e15722c14f8b3f16fafd25f62efde2115a4a..5352795f997cf27fd333f1c49563cebaa32c1e9a 100644 (file)
@@ -89,7 +89,7 @@ distdir.am footer.am header-vars.am header.am install.am java.am  \
 kr-extra.am library.am libs.am libtool.am lisp.am ltlib.am       \
 ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
 python.am remake-hdr.am remake.am scripts.am subdirs.am tags.am          \
-texi-vers.am texibuild.am texinfos.am
+texi-vers.am texibuild.am texinfos.am yacc.am
 
 
 dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
index 9d5c3213bf3aa255e64fab294700a0127dcd80fb..ec6a0726265afe307b051ae76ffddecf1aabcb0e 100755 (executable)
@@ -1495,28 +1495,13 @@ sub output_yacc_build_rule
 {
     my ($yacc_suffix, $use_ylwrap) = @_;
 
-    my $c_suffix = $yacc_suffix;
-    $c_suffix =~ tr/y/c/;
-    push (@suffixes, $yacc_suffix, $c_suffix);
+    (my $c_suffix = $yacc_suffix) =~ tr/y/c/;
 
     # Generate rule for c/c++.
-    $output_rules .= "$yacc_suffix$c_suffix:\n\t";
-
-    if ($use_ylwrap)
-    {
-       $output_rules .= ('$(SHELL) $(YLWRAP)'
-                         . ' "$(YACC)" $< y.tab.c $*' . $c_suffix
-                         . ' y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)');
-    }
-    else
-    {
-       $output_rules .= ('$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*'
-                         . $c_suffix . "\n"
-                         . "\tif test -f y.tab.h; then \\\n"
-                         . "\tif cmp -s y.tab.h \$*.h; then rm -f y.tab.h; else mv y.tab.h \$*.h; fi; \\\n"
-                         . "\telse :; fi");
-    }
-    $output_rules .= "\n";
+    $output_rules .= &file_contents ('yacc',
+                                    ('YACC_SUFFIX' => $yacc_suffix,
+                                     'C_SUFFIX'    => $c_suffix,
+                                     'YLWRAP'      => $use_ylwrap));
 }
 
 sub output_lex_build_rule
@@ -5589,6 +5574,19 @@ sub conditionals_true_when (@@)
     return 1;
 }
 
+
+sub condition_negate ($)
+{
+    my ($cond) = @_;
+
+    $cond =~ s/TRUE$/TRUEO/;
+    $cond =~ s/FALSE$/TRUE/;
+    $cond =~ s/TRUEO$/FALSE/;
+
+    return $cond;
+}
+
+
 # Check for an ambiguous conditional.  This is called when a variable
 # or target is being defined conditionally.  If we already know about
 # a definition that is true under the same conditions, then we have an
@@ -5967,10 +5965,8 @@ sub variable_conditions_permutations
     my $comp = shift (@comps);
     return &variable_conditions_permutations (@comps)
        if $comp eq '';
-    my $neg = $comp;
-    $neg =~ s/TRUE$/TRUEO/;
-    $neg =~ s/FALSE$/TRUE/;
-    $neg =~ s/TRUEO$/FALSE/;
+    my $neg = condition_negate ($comp);
+
     my @ret;
     foreach my $sub (&variable_conditions_permutations (@comps))
     {
@@ -6459,14 +6455,14 @@ sub read_am_file
            {
                &am_line_error ($., "else without if");
            }
-           elsif ($conditional_stack[$#conditional_stack] =~ /^(.*_)?FALSE$/)
+           elsif ($conditional_stack[$#conditional_stack] =~ /_FALSE$/)
            {
                &am_line_error ($., "else after else");
            }
            else
            {
                $conditional_stack[$#conditional_stack]
-                   =~ s/TRUE$/FALSE/;
+                 = condition_negate ($conditional_stack[$#conditional_stack]);
                $cond = conditional_string (@conditional_stack);
            }
        }
@@ -6827,14 +6823,15 @@ sub file_contents_internal ($%)
            {
                &am_error ("else without if");
            }
-           elsif ($cond_stack[$#cond_stack] =~ /^(.*_)?FALSE$/)
+           elsif ($cond_stack[$#cond_stack] =~ /_FALSE$/)
            {
                &am_error ("else after else");
            }
            else
            {
-               $cond_stack[$#cond_stack] =~ s/TRUE$/FALSE/;
-               $cond = conditional_string (@cond_stack);
+             $cond_stack[$#cond_stack] =
+               condition_negate ($cond_stack[$#cond_stack]);
+             $cond = conditional_string (@cond_stack);
            }
        }
        elsif (/$ENDIF_PATTERN/o)
index 8da2d3dac260a5b7284652af51c8237d16f1d4bb..ba257991a00652a7172bd9f2824751411f9bf832 100644 (file)
@@ -16,7 +16,7 @@ distdir.am footer.am header-vars.am header.am install.am java.am  \
 kr-extra.am library.am libs.am libtool.am lisp.am ltlib.am       \
 ltlibrary.am mans-vars.am mans.am multilib.am program.am progs.am \
 python.am remake-hdr.am remake.am scripts.am subdirs.am tags.am          \
-texi-vers.am texibuild.am texinfos.am
+texi-vers.am texibuild.am texinfos.am yacc.am
 
 dist_pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
 $(amfiles)
diff --git a/lib/am/yacc.am b/lib/am/yacc.am
new file mode 100644 (file)
index 0000000..5800ca2
--- /dev/null
@@ -0,0 +1,32 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
+
+## 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.
+
+## Generate rule for c/c++.
+%YACC_SUFFIX%%C_SUFFIX%:
+if %?YLWRAP%
+       $(SHELL) $(YLWRAP) $(YACC) $< y.tab.c $*%C_SUFFIX% y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)
+else
+       $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*%C_SUFFIX%
+       if test -f y.tab.h; then \
+         if cmp -s y.tab.h $*.h; then \
+           rm -f y.tab.h; \
+         else \
+           mv y.tab.h $*.h; \
+         fi; \
+       fi
+endif %?YLWRAP%
diff --git a/yacc.am b/yacc.am
new file mode 100644 (file)
index 0000000..5800ca2
--- /dev/null
+++ b/yacc.am
@@ -0,0 +1,32 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright 1998, 1999, 2001 Free Software Foundation, Inc.
+
+## 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.
+
+## Generate rule for c/c++.
+%YACC_SUFFIX%%C_SUFFIX%:
+if %?YLWRAP%
+       $(SHELL) $(YLWRAP) $(YACC) $< y.tab.c $*%C_SUFFIX% y.tab.h $*.h -- $(AM_YFLAGS) $(YFLAGS)
+else
+       $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*%C_SUFFIX%
+       if test -f y.tab.h; then \
+         if cmp -s y.tab.h $*.h; then \
+           rm -f y.tab.h; \
+         else \
+           mv y.tab.h $*.h; \
+         fi; \
+       fi
+endif %?YLWRAP%
This page took 0.051661 seconds and 5 git commands to generate.