(&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 (&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.
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)
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 \
{
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
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
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))
{
{
&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);
}
}
{
&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)
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)
--- /dev/null
+## 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%
--- /dev/null
+## 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%