]> sourceware.org Git - automake.git/commitdiff
generate .h file from .y file as necessary
authorTom Tromey <tromey@redhat.com>
Fri, 25 Apr 1997 19:10:58 +0000 (19:10 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 25 Apr 1997 19:10:58 +0000 (19:10 +0000)
ChangeLog
automake.in

index c0448606f5abd478551697d439f41c33051bbbed..b0e3dc26c7cf086426aa335dc24ef691e17eb5ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 Fri Apr 25 12:33:23 1997  Tom Tromey  <tromey@cygnus.com>
 
+       * automake.in (output_yacc_build_rule): Generate rule to create .h
+       file.
+       (handle_footer): Generate unique, sorted list of suffixes.
+
        * automake.in (scan_one_configure_file): Recognize AC_PROG_AWK,
        _CPP, _CXCPP, _LN_S.  From Ralph Schleicher.
 
index f9a14cab85a1716b7f60925bc4061d20ac8eb1e1..b3600d282dd14f363f2a8bc492a3d3ca3778f5cb 100755 (executable)
@@ -928,27 +928,33 @@ 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) = @_;
-    local ($c_suffix);
+    local ($yacc_suffix, $use_interlock, $c_suffix) = @_;
 
+    local ($c_suffix, $suffix);
     ($c_suffix = $yacc_suffix) =~ tr/y/c/;
-    push (@suffixes, $yacc_suffix);
-    $output_rules .= "$yacc_suffix$c_suffix:\n\t";
+    push (@suffixes, $yacc_suffix, $c_suffix, '.h');
 
-    if ($use_interlock)
-    {
-       $output_rules .= '$(SHELL) $(INTERLOCK) =yacclockdir $(YLWRAP)'
-           . ' "$(YACC)" y.tab.c $*' . $c_suffix 
-           . ' y.tab.h $*.h -- $(YFLAGS) $<';
-    }
-    else
+    # Generate rule for c/c++ and header file.  Probably should only
+    # do header if `yacc -d' is run.
+    foreach $suffix ($c_suffix, '.h')
     {
-       $output_rules .= ('$(YACC) $(YFLAGS) $< && mv y.tab.c $@' . "\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"
+       $output_rules .= "$yacc_suffix$suffix:\n\t";
+
+       if ($use_interlock)
+       {
+           $output_rules .= ('$(SHELL) $(INTERLOCK) =yacclockdir $(YLWRAP)'
+                             . ' "$(YACC)" y.tab.c $*' . $suffix 
+                             . ' y.tab.h $*.h -- $(YFLAGS) $<');
+       }
+       else
+       {
+           $output_rules .= ('$(YACC) $(YFLAGS) $< && mv y.tab.c $@' . "\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 .= "\n";
 }
 
 sub output_lex_build_rule
@@ -3074,7 +3080,16 @@ sub handle_footer
     $output_header .= ".SUFFIXES:\n";
     if (@suffixes)
     {
-       $output_header .= ".SUFFIXES: " . join (' ', @suffixes) . "\n";
+
+       # Make sure suffixes has unique elements.  Sort them to ensure
+       # the output remains consistent.
+       local (%suffixes);
+
+       grep ($suffixes{$_} = 1, @suffixes);
+
+       $output_header .= (".SUFFIXES: "
+                          . join (' ', sort keys %suffixes)
+                          . "\n");
     }
     $output_trailer .= &file_contents ('footer');
 }
This page took 0.041973 seconds and 5 git commands to generate.