Added AUTOMAKE_OPTIONS
authorTom Tromey <tromey@redhat.com>
Fri, 12 Jan 1996 06:48:19 +0000 (06:48 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 12 Jan 1996 06:48:19 +0000 (06:48 +0000)
Fixes from Franc,ois

13 files changed:
ChangeLog
Makefile.am
Makefile.in
NEWS
TODO
automake.in
clean.am
depend.am
kr-vars.am
lib/am/Makefile.am
lib/am/clean.am
lib/am/depend.am
tags-subd.am

index eeed9cc..840f0da 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,46 @@
+Thu Jan 11 23:14:18 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * Makefile.am (AUTOMAKE_OPTIONS): New variable.
+
+       * automake.in (strictness, strictness_name): Renamed.
+       (initialize_per_input): Set strictness, strictness_name.
+       Initialize %options.
+       (generate_makefile): Run handle_options.
+       (handle_options): New function.
+       (handle_man_pages): Make install-man depend on $(MANS).  Turn off
+       man page install if no-installman option given.
+       (read_am_file): Deprecate @kr@.
+       (get_object_extension): Look at ansi2knr option.
+       (parse_arguments): Take global strictness from command-line
+       options.
+
+Tue Jan  9 11:24:14 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       Fixes from François Pinard:
+       * depend.am ($(srcdir)/.deps/%.P): Handle deansification.
+       * automake.in (get_object_extension): Use $o, not $(kr)o.
+       (handle_source_transform): Don't look for $(kr)c files.
+       * kr-vars.am (o): New macro.
+       (kr): Removed.
+
+       * depend.am (DEP_FILES): Removed.
+       * automake.in (handle_source_transform): Push .P file onto
+       dep_files.
+       (initialize_per_input): New variable %dep_files.
+       (handle_dependencies): Generate DEP_FILES here.
+
+Mon Jan  8 22:27:33 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * automake.in (do_one_clean_target): Only remove config.status in
+       top-level directory.
+       (handle_tags): Removed 'id' from .PHONY list.  From Jim Meyering.
+
+       * clean.am (maintainer-clean-generic): Remove BUILT_SOURCES.
+
+       * automake.in (handle_dist): Make "ln" quiet.
+
+       * tags-subd.am (ID): Depend on HEADERS and SOURCES.
+
 Sat Jan  6 10:58:23 1996  Tom Tromey  <tromey@cambric.colorado.edu>
 
        * automake.in (handle_merge_targets): 'check' shouldn't depend on
index fe05d1c..c99d6e7 100644 (file)
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = gnits
+
 bin_SCRIPTS = automake
 TEXINFOS = automake.texi
 # SUBDIRS = intl po
index 56dff1c..df20bbe 100644 (file)
@@ -36,6 +36,8 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 transform = @program_transform_name@
 
+AUTOMAKE_OPTIONS = gnits
+
 bin_SCRIPTS = automake
 TEXINFOS = automake.texi
 # SUBDIRS = intl po
@@ -74,8 +76,8 @@ DATA = $(pkgdata_DATA)
 
 ACLOCAL = aclocal.m4
 DIST_COMMON = README mkinstalldirs configure Makefile.in stamp-vti \
-configure.in ChangeLog THANKS README version.texi mdate-sh TODO INSTALL \
-COPYING Makefile.am texinfo.tex NEWS aclocal.m4 install-sh
+AUTHORS configure.in ChangeLog THANKS README version.texi mdate-sh TODO \
+INSTALL COPYING Makefile.am texinfo.tex NEWS aclocal.m4 install-sh
 
 
 PACKAGE = @PACKAGE@
@@ -188,7 +190,7 @@ config.status: configure
 $(srcdir)/configure: configure.in $(ACLOCAL)
        cd $(srcdir) && autoconf
 
-ID:
+ID:    $(HEADERS) $(SOURCES)
        here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS)
 
 tags: TAGS
@@ -214,7 +216,7 @@ dist: $(DISTFILES)
          && automake --include-deps --output-dir=$$distdir --strictness=gnits
        @for file in $(DISTFILES); do           \
          test -f $(distdir)/$$file \
-         || ln $(srcdir)/$$file $(distdir)/$$file \
+         || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
          || cp -p $(srcdir)/$$file $(distdir)/$$file; \
        done
        for subdir in $(SUBDIRS); do            \
@@ -266,6 +268,7 @@ distclean-generic:
 
 maintainer-clean-generic:
        test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+       test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
 mostlyclean:  mostlyclean-binSCRIPTS mostlyclean-vti mostlyclean-info \
 mostlyclean-tags mostlyclean-generic
 
@@ -287,7 +290,7 @@ distclean
 clean-binSCRIPTS maintainer-clean-binSCRIPTS uninstall-binSCRIPTS \
 mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \
 install-info uninstall-info mostlyclean-info distclean-info clean-info \
-maintainer-clean-info uninstall-pkgdataDATA tags id mostlyclean-tags \
+maintainer-clean-info uninstall-pkgdataDATA tags mostlyclean-tags \
 distclean-tags clean-tags maintainer-clean-tags dist all info dvi check \
 installcheck install-exec install-data install uninstall installdirs \
 mostlyclean-generic distclean-generic clean-generic \
diff --git a/NEWS b/NEWS
index 2e4206f..3cf6b71 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ New in 0.28:
 * More standards checking
 * Bug fixes
 * Cleaned up 'dist' targets
+* Added AUTOMAKE_OPTIONS variable
 \f
 New in 0.27:
 * Works with Perl 4 again
diff --git a/TODO b/TODO
index 2218100..6587de0 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,7 +11,9 @@ Top priorities:
 
 * am_error should use printf-style arguments (for eventual gettext scheme)
 
-Add AM_OPTIONS macro.  Can include:
+BUILT_SOURCES should go in distribution
+
+Add AUTOMAKE_OPTIONS macro.  Can include:
 "gnits", "gnu", "normal", "ansi2kr", "installman"
 
 uninstall and pkg-dirs should rm -rf the dir.
@@ -79,7 +81,7 @@ Allow ".h" files to appear in blah_SOURCES; just write them out of
 existence.  [ This is nixed for now because of the auto-dependency
 tracking stuff ]
 
-automake.in: should ".cc" really -> ".${kr}o"?  This doesn't really
+automake.in: should ".cc" really -> ".$(kr)o"?  This doesn't really
 seem right, but maybe it is so names can be rewritten uniformly?  Must
 check
 
index 8dd9b6f..f36b06d 100755 (executable)
@@ -49,11 +49,11 @@ $GNITS = 2;
 
 # Variables global to entire run.
 
-# Strictness level.
-$strictness = $NORMAL;
+# Strictness level as set on command line.
+$default_strictness = $NORMAL;
 
-# Name of strictness level.
-$strictness_name = 'normal';
+# Name of strictness level, as set on command line.
+$default_strictness_name = 'normal';
 
 # This is TRUE if GNU make specific automatic dependency generation
 # code should be included in generated Makefile.in.
@@ -177,6 +177,10 @@ sub parse_arguments
        shift (@arglist);
     }
 
+    # Take global strictness from whatever we currently have set.
+    $default_strictness = $strictness;
+    $default_strictness_name = $strictness_name;
+
     if (! @make_list)
     {
        # Look around for some files.
@@ -226,6 +230,7 @@ sub generate_makefile
     push (@phony, 'default');
 
     &read_am_file ($makefile . '.am');
+    &handle_options;
 
     # Check first, because we might modify some state.
     &check_gnu_standards;
@@ -275,6 +280,29 @@ sub generate_makefile
 
 ################################################################
 
+# Handle AUTOMAKE_OPTIONS variable.
+sub handle_options
+{
+    return if ! defined $contents{'AUTOMAKE_OPTIONS'};
+
+    foreach (split (/\s+/, $contents{'AUTOMAKE_OPTIONS'}))
+    {
+       $options{$_} = 1;
+       if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'normal')
+       {
+           &set_strictness ($_);
+       }
+       elsif ($_ eq 'no-installman' || $_ eq 'ansi2knr')
+       {
+           # Explicitly recognize these.
+       }
+       else
+       {
+           &am_error ('option ', $_, 'not recognized');
+       }
+    }
+}
+
 # Return object extension.  Just once, put some code into the output.
 sub get_object_extension
 {
@@ -291,9 +319,9 @@ sub get_object_extension
        push (@suffixes, '.c', '.o');
        push (@clean, 'compile');
 
-       if (defined $contents{'@kr@'})
+       if (defined $options{'ansi2knr'} || defined $contents{'@kr@'})
        {
-           $dir_holds_sources = '.$(kr)o';
+           $dir_holds_sources = '$o';
            push (@suffixes, '._c', '._o');
 
            &require_file ($NORMAL, 'ansi2knr.c', 'ansi2knr.1');
@@ -322,7 +350,7 @@ sub handle_source_transform
            # Turn sources into objects.
            local (@files) = split (/\s+/, $contents{$one_file . "_SOURCES"});
            # Ugh: Perl syntax vs Emacs.
-           local ($krc1, $krc2) = ('\.\$\{kr\}c', '\.\$\(kr\)c');
+           local ($krc1, $krc2) = ('\.\$\{kr\}c', '\.\$\(kr\)c');
            local (@result) = ();
            foreach (@files)
            {
@@ -335,11 +363,15 @@ sub handle_source_transform
 
                # Transform source files into .o files.
                s/\.cc$/$obj/g;
-               s/$krc1$/$obj/g;
-               s/$krc2$/$obj/g;
+               s/$krc1$/$obj/g;
+               s/$krc2$/$obj/g;
                s/\.[cCmylfs]$/$obj/g;
-
                push (@result, $_);
+
+               # Transform .o file into .P file (for automatic
+               # dependency code).
+               s/$obj/.P/g;
+               $dep_files{$_} = 1;
            }
 
            &pretty_print ($one_file . "_OBJECTS =", '', @result);
@@ -559,7 +591,7 @@ sub handle_man_pages
     }
 
     # Generate list of install dirs.
-    $output_rules .= "install-man:\n";
+    $output_rules .= "install-man: $(MANS)\n";
     foreach (keys %sections)
     {
        push (@installdirs, '$(mandir)/man' . $_);
@@ -596,9 +628,12 @@ sub handle_man_pages
 
     $output_vars .= &file_contents ('mans-vars');
 
-    push (@install_data, 'install-man');
-    push (@uninstall, 'uninstall-man');
-    push (@all, '$(MANS)');
+    if (! defined $options{'no-installman'})
+    {
+       push (@install_data, 'install-man');
+       push (@uninstall, 'uninstall-man');
+       push (@all, '$(MANS)');
+    }
 }
 
 # Handle DATA variables.
@@ -623,7 +658,6 @@ sub handle_tags
     elsif ($dir_holds_sources || defined $contents{'ETAGS_ARGS'})
     {
        $output_rules .= &file_contents ('tags-subd');
-       push (@phony, 'id');
        $tagging = 1;
     }
 
@@ -717,7 +751,7 @@ dist: $(DISTFILES)
     # distribution.
     $output_rules .= ' @for file in $(DISTFILES); do           \\
          test -f $(distdir)/$$file \\
-         || ln $(srcdir)/$$file $(distdir)/$$file \\
+         || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \\
          || cp -p $(srcdir)/$$file $(distdir)/$$file; \\
        done
 ';
@@ -769,6 +803,7 @@ sub handle_dependencies
        # Include GNU-make-specific auto-dep code.
        if ($dir_holds_sources)
        {
+           &pretty_print ('DEP_FILES =', '', sort keys %dep_files);
            $output_rules .= &file_contents ('depend');
        }
     }
@@ -1130,8 +1165,10 @@ sub do_one_clean_target
        $output_rules .=
            ("\t\@echo \"This command is intended for maintainers to use;\"\n"
             . "\t\@echo \"it deletes files that may require special "
-            . "tools to rebuild.\"\n"
-            . "\trm -f config.status\n");
+            . "tools to rebuild.\"\n");
+
+       $output_rules .= "\trm -f config.status\n"
+           if $relative_dir eq '.';
     }
     elsif ($name . $target eq 'distclean')
     {
@@ -1346,8 +1383,10 @@ sub read_am_file
        elsif ($_ eq "\@kr\@\n")
        {
            # Special case: this means we want automatic
-           # de-ANSI-fication.  FIXME think of a better way.
+           # de-ANSI-fication.  This is deprecated.  Remove in the
+           # future.
            $contents{'@kr@'} = 1;
+           &am_error ('@kr@ is deprecated; put "ansi2knr" in AUTOMAKE_OPTIONS instead');
        }
        else
        {
@@ -1493,6 +1532,16 @@ sub initialize_per_input
 
     # TRUE if install targets should work recursively.
     $recursive_install = 0;
+
+    # All .P files.
+    %dep_files = ();
+
+    # Strictness levels.
+    $strictness = $default_strictness;
+    $strictness_name = $default_strictness_name;
+
+    # Options from AUTOMAKE_OPTIONS.
+    %options = ();
 }
 
 
index 2e40fdb..81729da 100644 (file)
--- a/clean.am
+++ b/clean.am
@@ -29,3 +29,4 @@ distclean-generic:
 
 maintainer-clean-generic:
        test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+       test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
index 7959251..6537236 100644 (file)
--- a/depend.am
+++ b/depend.am
@@ -21,9 +21,6 @@
 
 MKDEP = gcc -MM $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
 
-## Use $(kr) in case we are doing auto-deANSIfication.
-DEP_FILES = $(patsubst %.$(kr)o, $(srcdir)/.deps/%.P,$(OBJECTS))
-
 ## We use ".P" as the name of our placeholder because it can't be
 ## duplicated by any C source file.  (Well, there could be ".c", but
 ## no one does that in practice)
@@ -44,6 +41,10 @@ $(srcdir)/.deps/%.P: $(srcdir)/%.c
 ## operator, and commonly appears in filenames.
        @re=`echo 's,\<$(srcdir),,g' | sed 's/\./\\./g'`; \
          $(MKDEP) $< | sed $$re > $@-tmp
-       @mv $@-tmp $@
+       @if test -n "$o"; then                  \
+         sed 's/\.o:/$$o:/' $@-tmp > $@;       \
+       else                                    \
+         mv $@-tmp $@;                         \
+       fi
 
 # End of maintainer-only section
index 6e34544..2714d7d 100644 (file)
@@ -16,4 +16,4 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
 ANSI2KNR = @ANSI2KNR@
-kr = @U@
+o = @U@o
index fe05d1c..c99d6e7 100644 (file)
@@ -1,3 +1,5 @@
+AUTOMAKE_OPTIONS = gnits
+
 bin_SCRIPTS = automake
 TEXINFOS = automake.texi
 # SUBDIRS = intl po
index 2e40fdb..81729da 100644 (file)
@@ -29,3 +29,4 @@ distclean-generic:
 
 maintainer-clean-generic:
        test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+       test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
index 7959251..6537236 100644 (file)
@@ -21,9 +21,6 @@
 
 MKDEP = gcc -MM $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
 
-## Use $(kr) in case we are doing auto-deANSIfication.
-DEP_FILES = $(patsubst %.$(kr)o, $(srcdir)/.deps/%.P,$(OBJECTS))
-
 ## We use ".P" as the name of our placeholder because it can't be
 ## duplicated by any C source file.  (Well, there could be ".c", but
 ## no one does that in practice)
@@ -44,6 +41,10 @@ $(srcdir)/.deps/%.P: $(srcdir)/%.c
 ## operator, and commonly appears in filenames.
        @re=`echo 's,\<$(srcdir),,g' | sed 's/\./\\./g'`; \
          $(MKDEP) $< | sed $$re > $@-tmp
-       @mv $@-tmp $@
+       @if test -n "$o"; then                  \
+         sed 's/\.o:/$$o:/' $@-tmp > $@;       \
+       else                                    \
+         mv $@-tmp $@;                         \
+       fi
 
 # End of maintainer-only section
index c66f913..75fc4a6 100644 (file)
@@ -15,7 +15,7 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
-ID:
+ID:    $(HEADERS) $(SOURCES)
        here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS)
 
 tags: TAGS