automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

yacc -d


From: Ralf Corsepius
Subject: yacc -d
Date: Wed, 23 May 2001 02:53:28 +0200

Now that automake parses yacc -d from AM_YFLAGS and automatically
puts yacc -d generated headers into DIST_COMMON, I think, the patch
below probably should be applied.

It basically reverts automake's handling of yacc headers to
expanding the suffix from the yacc-source file's suffix. IIRC, this
behavior had been the default behavior, but has been disabled,
because automake-1.4 wasn't able to check AM_YFLAGS for presense of
-d at that time (I found the referring ChangeLog entry, but the
mailing-list archive doesn't seem to reach back that long.)

Anyway, even with this patch applied this stuff is still rather
fragile (eg. bison/yacc -b, YFLAGS ).

Ralf
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1127
diff -u -r1.1127 automake.in
--- automake.in 2001/05/20 04:40:51     1.1127
+++ automake.in 2001/05/23 00:08:30
@@ -1645,12 +1645,14 @@
     my ($yacc_suffix, $use_ylwrap) = @_;
 
     (my $c_suffix = $yacc_suffix) =~ tr/y/c/;
+    (my $h_suffix = $yacc_suffix) =~ tr/y/h/;
 
     # Generate rule for c/c++.
     $output_rules .= &file_contents ('yacc',
                                     ('YLWRAP'      => $use_ylwrap,
                                      'YACC_SUFFIX' => $yacc_suffix,
-                                     'C_SUFFIX'    => $c_suffix));
+                                     'C_SUFFIX'    => $c_suffix,
+                                     'H_SUFFIX'    => $h_suffix,));
 }
 
 sub output_lex_build_rule
@@ -5033,7 +5035,8 @@
 
        $file =~ /^(.*)\.(y|yy|y\+\+|yxx|ypp)$/;
        my $base = $1;
-       my $hname = 'h';                # Always use `.h' for header file.
+       my $hname = $2 ;
+       $hname =~ tr/y/h/;
        my $cname = $2;
        $cname =~ tr/y/c/;
 
Index: lib/am/yacc.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/yacc.am,v
retrieving revision 1.4
diff -u -r1.4 yacc.am
--- yacc.am     2001/05/15 02:21:53     1.4
+++ yacc.am     2001/05/23 00:08:36
@@ -19,14 +19,14 @@
 ## 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)
+       $(SHELL) $(YLWRAP) $(YACC) $< y.tab.c $*%C_SUFFIX% y.tab.h $*%H_SUFFIX% 
-- $(AM_YFLAGS) $(YFLAGS)
 else !%?YLWRAP%
        $(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 \
+         if cmp -s y.tab.h $*%H_SUFFIX%; then \
            rm -f y.tab.h; \
          else \
-           mv y.tab.h $*.h; \
+           mv y.tab.h $*%H_SUFFIX%; \
          fi; \
        fi
 endif !%?YLWRAP%

reply via email to

[Prev in Thread] Current Thread [Next in Thread]