From 1dc0afd17e7d8ceb569abf1c49c979da9cdba9fc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 8 Nov 1996 22:20:55 +0000 Subject: [PATCH] More Cygnus fixes Handle OMIT_DEPENDENCIES --- ChangeLog | 25 +++++++++++++ NEWS | 3 ++ TODO | 4 +++ automake.in | 89 ++++++++++++++++++++++++++++++++++------------ dist-vars.am | 5 +-- lib/am/texinfos.am | 31 ++++++++++++---- texinfos.am | 31 ++++++++++++---- 7 files changed, 149 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b4c396b..d281a33c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,30 @@ Fri Nov 8 09:49:09 1996 Tom Tromey + * automake.in (handle_dist_worker): In Cygnus mode, possibly find + files to dist in build dir, not srcdir. + (%omit_dependencies): New global. + (scan_dependency_file): Handle OMIT_DEPENDENCIES. + (scan_configure): Put rx.h, regex.h on %omit_dependencies. Ditto + libintl.h. + (handle_tests): Remove CYGNUS strings in Cygnus mode. + (handle_texinfo): Ditto. + + * texinfos.am (dist-info): New target. + + * automake.in (handle_dist_worker): Use DISTFILES, not + DEP_DISTFILES. + (initialize_per_input): Initialize dist_targets. + (handle_texinfo): Don't compute @infos_list; don't define or use + INFOS. Put dist-info onto @dist_targets. + (handle_dist_worker): Handle @dist_targets. Don't use the "echo + trick" for expanding DISTFILES any more. + + * dist-vars.am (DEP_DISTFILES): Removed. + (DISTFILES): Don't include INFOS. + + * automake.in (handle_texinfo): Handle Cygnus mode. + * texinfos.am (.texi.info, .texinfo.info): Handle Cygnus mode. + * automake.in (handle_single_transform_list): New sub. (handle_source_transform): Use it. (handle_built_sources): New sub. diff --git a/NEWS b/NEWS index bddcb454..e5dbf0d9 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,9 @@ New in 1.1g: * Support for "yacc -d" * configure substitutions are automatically discovered and included in generated Makefile.in +* Special --cygnus mode +* OMIT_DEPENDENCIES can now hold list of dependencies to be omitted + when making distribution. Some dependencies are auto-ignored. New in 1.0: * Bug fixes diff --git a/TODO b/TODO index b9f31b0a..b5cffdea 100644 --- a/TODO +++ b/TODO @@ -317,6 +317,10 @@ containing application. Document: +--cygnus + +OMIT_DEPENDENCIES + write example of using automake with dejagnu follow calc example in dejagnu docs diff --git a/automake.in b/automake.in index f7fd1af3..6b887f4f 100755 --- a/automake.in +++ b/automake.in @@ -207,6 +207,9 @@ $in_file_name = ''; # TRUE if --cygnus seen. $cygnus_mode = 0; +# Keys of this hash are names of dependency files to ignore. +%omit_dependencies = (); + &initialize_global_constants; @@ -1421,7 +1424,7 @@ sub handle_texinfo local (@texis) = &variable_value_as_list ('info_TEXINFOS'); - local (@infos_list, @info_deps_list, @dvis_list, @texi_deps); + local (@info_deps_list, @dvis_list, @texi_deps); local ($infobase, $info_cursor); local (%versions); local ($done) = 0; @@ -1489,9 +1492,6 @@ sub handle_texinfo . join (' ', @texi_deps) . "\n\n"); - # FIXME: this distributes too much. How to find out precisely - # which files will be generated by `makeinfo'? - push (@infos_list, $infobase . '.info', $infobase . '.info[-0-9]*'); push (@info_deps_list, $infobase . '.info'); push (@dvis_list, $infobase . '.dvi'); @@ -1512,15 +1512,27 @@ sub handle_texinfo 'makeinfo'); &define_program_variable ('TEXI2DVI', 'src', 'texinfo/util', 'texi2dvi'); - $output_rules .= &file_contents ('texinfos'); + + local ($xform); + if ($cygnus_mode) + { + $xform = 'next if /^NOTCYGNUS/; s/^CYGNUS//;'; + } + else + { + $xform = 'next if /^CYGNUS/; s/^NOTCYGNUS//;'; + } + $output_rules .= &file_contents_with_transform ($xform, 'texinfos'); push (@phony, 'install-info-am', 'uninstall-info'); + push (@dist_targets, 'dist-info'); # How to clean. $output_rules .= "\nmostlyclean-info:\n"; &pretty_print_rule ("\trm -f", "\t ", @texi_cleans); $output_rules .= ("\nclean-info:\n\ndistclean-info:\n\n" . "maintainer-clean-info:\n\t" - . 'rm -f $(INFOS)' . "\n"); + . 'for i in $(INFO_DEPS); do rm `eval echo $i*`; done' + . "\n"); &push_phony_cleaners ('info'); push (@suffixes, '.texi', '.texinfo', '.info', '.dvi'); @@ -1540,7 +1552,6 @@ sub handle_texinfo push (@info, '$(INFO_DEPS)'); push (@dvi, '$(DVIS)'); - &define_variable ("INFOS", join (' ', @infos_list)); &define_variable ("INFO_DEPS", join (' ', @info_deps_list)); &define_variable ("DVIS", join (' ', @dvis_list)); # This next isn't strictly needed now -- the places that look here @@ -1683,7 +1694,7 @@ sub handle_tags # Worker for handle_dist. sub handle_dist_worker { - $output_rules .= 'distdir: $(DEP_DISTFILES)' . "\n"; + $output_rules .= 'distdir: $(DISTFILES)' . "\n"; # Initialization; only at top level. if ($relative_dir eq '.') @@ -1762,12 +1773,19 @@ sub handle_dist_worker # Also, there are situations in which "ln" can fail. For instance # a file to distribute could actually be a cross-filesystem # symlink -- this can easily happen if "gettextize" was run on the - # distribution. Note that DISTFILES can contain a wildcard (for - # info files, sigh), so we must use the echo trick. - $output_rules .= ' @for file in `cd $(srcdir) && echo $(DISTFILES)`; do \\ - test -f $(distdir)/$$file \\ - || ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \\ - || cp -p $(srcdir)/$$file $(distdir)/$$file; \\ + # distribution. + $output_rules .= "\t\@for file in \$(DISTFILES); do \\\n"; + if ($cygnus_mode) + { + $output_rules .= "\t if test -f \$\$file; then d=.; else d=\$(srcdir); fi; \\\n"; + } + else + { + $output_rules .= "\t d=\$(srcdir); \\\n"; + } + $output_rules .= ' test -f $(distdir)/$$file \\ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \\ + || cp -p $$d/$$file $(distdir)/$$file; \\ done '; @@ -1792,13 +1810,16 @@ sub handle_dist_worker '; } - # If the target `dist-hook' exists, run it now. This allows - # users to do random weird things to the distribution before it is - # packaged up. - if (defined $contents{'dist-hook'}) + # If the target `dist-hook' exists, make sure it is run. This + # allows users to do random weird things to the distribution + # before it is packaged up. + push (@dist_targets, 'dist-hook') if defined $contents{'dist-hook'}; + + local ($targ); + foreach $targ (@dist_targets) { - # We must explicitly set distdir here. - $output_rules .= "\t\$(MAKE) distdir=\"$(distdir)\" dist-hook\n"; + # We must explicitly set distdir for these sub-makes. + $output_rules .= "\t\$(MAKE) distdir=\"$(distdir)\" $targ\n"; } push (@phony, 'distdir'); @@ -1947,10 +1968,18 @@ sub scan_dependency_file } print "automake: reading $depfile\n" if $verbose; + # Sometimes it is necessary to omit some dependencies. + local (%omit) = %omit_dependencies; + if (&variable_defined ('OMIT_DEPENDENCIES')) + { + grep ($omit{$_} = 1, &variable_value_as_list ('OMIT_DEPENDENCIES')); + } + local ($first_line) = 1; local ($last_line) = 0; local ($target, @dependencies); local ($one_dep, $xform); + local ($just_file); local ($srcdir_rx, $fixup_rx); # If the top srcdir is absolute, then the current directory is @@ -2024,8 +2053,12 @@ sub scan_dependency_file } else { - # Anything else is assumed to be correct. - push (@dependencies, $one_dep); + # Anything else is assumed to be correct. But first + # make sure it is not on our list of dependencies to + # omit. + ($just_file = $one_dep) =~ s,^.*/,,; + push (@dependencies, $one_dep) + if ! defined $omit{$just_file}; } } } @@ -2769,7 +2802,11 @@ sub handle_tests push (@phony, 'check-DEJAGNU'); local ($xform); - if (! $cygnus_mode) + if ($cygnus_mode) + { + $xform = 's/^CYGNUS//;'; + } + else { $xform = 'next if /^CYGNUS/;'; } @@ -2962,6 +2999,8 @@ sub scan_configure $libsources{'rx.h'} = 1; $libsources{'regex.c'} = 1; $libsources{'regex.h'} = 1; + $omit_dependencies{'rx.h'} = 1; + $omit_dependencies{'regex.h'} = 1; } elsif (/AM_FUNC_MKTIME/) { @@ -3047,6 +3086,7 @@ sub scan_configure { $seen_gettext = 1; $ac_gettext_line = $.; + $omit_dependencies{'libintl.h'} = 1; } # Look for ALL_LINGUAS. @@ -3835,6 +3875,9 @@ sub initialize_per_input # TRUE if we've seen any non-C++ sources. $seen_c_source = 0; + + # This is a list of all targets to run during "make dist". + @dist_targets = (); } diff --git a/dist-vars.am b/dist-vars.am index 9d199255..bdd0f39e 100644 --- a/dist-vars.am +++ b/dist-vars.am @@ -20,9 +20,6 @@ VERSION = @VERSION@ ## DIST_COMMON comes first so that README can be the very first file. DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \ - $(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) -## Like DISTFILES, but look at INFO_DEPS, not INFOS. -DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) \ - $(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) + $(TEXINFOS) $(MANS) $(EXTRA_DIST) TAR = tar diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index dee8d616..59a63c0b 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -17,9 +17,12 @@ ## 02111-1307, USA. .texi.info: ## We want to force the .info file to be built in srcdir. This is -## probably the simplest way. - cd $(srcdir) \ - && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +## probably the simplest way. However, at Cygnus .info files are +## always put into the build directory. So at runtime we select which +## rule to use. +NOTCYGNUS cd $(srcdir) \ +NOTCYGNUS && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +CYGNUS $(MAKEINFO) $< .texi.dvi: TEXINPUTS=$(srcdir):$$TEXINPUTS \ @@ -29,9 +32,12 @@ .texinfo.info: ## We want to force the .info file to be built in srcdir. This is -## probably the simplest way. - cd $(srcdir) \ - && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +## probably the simplest way. However, at Cygnus .info files are +## always put into the build directory. So at runtime we select which +## rule to use. +NOTCYGNUS cd $(srcdir) \ +NOTCYGNUS && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +CYGNUS $(MAKEINFO) $< .texinfo.dvi: TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $< @@ -74,3 +80,16 @@ uninstall-info: (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \ done + +dist-info: + for base in $(INFO_DEPS); do \ +## In Cygnus mode, allow info file to be in source or build dir. In +## other modes, allow only source dir. +NOTCYGNUS d=$(srcdir); \ +CYGNUS if test -f $$base; then d=.; else d=$(srcdir); fi; \ + for file in `cd $$d && eval echo $$base*`; do \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \\ + || cp -p $$d/$$file $(distdir)/$$file; \\ + done; \ + done diff --git a/texinfos.am b/texinfos.am index dee8d616..59a63c0b 100644 --- a/texinfos.am +++ b/texinfos.am @@ -17,9 +17,12 @@ ## 02111-1307, USA. .texi.info: ## We want to force the .info file to be built in srcdir. This is -## probably the simplest way. - cd $(srcdir) \ - && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +## probably the simplest way. However, at Cygnus .info files are +## always put into the build directory. So at runtime we select which +## rule to use. +NOTCYGNUS cd $(srcdir) \ +NOTCYGNUS && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +CYGNUS $(MAKEINFO) $< .texi.dvi: TEXINPUTS=$(srcdir):$$TEXINPUTS \ @@ -29,9 +32,12 @@ .texinfo.info: ## We want to force the .info file to be built in srcdir. This is -## probably the simplest way. - cd $(srcdir) \ - && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +## probably the simplest way. However, at Cygnus .info files are +## always put into the build directory. So at runtime we select which +## rule to use. +NOTCYGNUS cd $(srcdir) \ +NOTCYGNUS && $(MAKEINFO) `echo $< | sed 's,.*/,,'` +CYGNUS $(MAKEINFO) $< .texinfo.dvi: TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $< @@ -74,3 +80,16 @@ uninstall-info: (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \ done + +dist-info: + for base in $(INFO_DEPS); do \ +## In Cygnus mode, allow info file to be in source or build dir. In +## other modes, allow only source dir. +NOTCYGNUS d=$(srcdir); \ +CYGNUS if test -f $$base; then d=.; else d=$(srcdir); fi; \ + for file in `cd $$d && eval echo $$base*`; do \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \\ + || cp -p $$d/$$file $(distdir)/$$file; \\ + done; \ + done -- 2.43.5