From e300eb85e345fac7c82aa0249eea62b9d3a497de Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 5 Apr 1996 07:44:21 +0000 Subject: [PATCH] Bug fix --- ChangeLog | 3 ++ NEWS | 4 +-- TODO | 10 +++---- automake.in | 82 ++++++++++++++++++++++++++++++++++++------------------- automake.texi | 19 +++++++++++-- lib/mkinstalldirs | 6 +++- mkinstalldirs | 6 +++- version.texi | 2 +- 8 files changed, 91 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 999289b..7222ffa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Fri Apr 5 00:22:14 1996 Tom Tromey + * mkinstalldirs (errstatus): Don't necessarily die if mkdir + fails. + * automake.in (handle_source_transform): Typo fix. Thu Apr 4 15:10:50 1996 Tom Tromey diff --git a/NEWS b/NEWS index 1e9b119..2a3e034 100644 --- a/NEWS +++ b/NEWS @@ -4,8 +4,8 @@ New in 0.32: AC_CONFIG_AUX_DIR. * Removed DIST_SUBDIRS, DIST_OTHER * AC_ARG_PROGRAM only required when an actual program exists -* dist-local target now run before distribution packaged up; idea from - Dieter Baron. +* dist-hook target now run before distribution packaged up; idea from + Dieter Baron. Other hooks exist, too. * Preliminary (unfinished) support for libtool New in 0.31: diff --git a/TODO b/TODO index 266c6e1..1c4b974 100644 --- a/TODO +++ b/TODO @@ -2,9 +2,8 @@ Priorities for release: * Fix all mkinstalldirs invocations * Add support for libtool * At top level, config.h is not depended on... -* Rename dist-local -> dist-hook -* Add install-data-hook, install-exec-hook * Must look for/enforce existence of stamp-h.in in srcdir? + ... there is something broken here... * Should be a way to have "nobuild_PROGRAMS" which aren't even built, but which could be by running the magic make command. @@ -14,7 +13,6 @@ Other priorities: * Rewrite clean targets. * Must rewrite error handling code. Right now it is a real mess Should fix up require_file junk at the same time -* Add EXTRA_prog_SOURCES, for eg Apache Things to finish libtool support: * Handle grody compilation issue @@ -37,9 +35,6 @@ an option Think about ways to make automake fit better with Cygnus-style trees. -Omit program transform vars from header if no program installed. This -is currently pretty hard to do. - Use recode in dist target when MAINT_CHARSET specified. Read caveats in automake.in before doing this. Note the same problem used to apply to the no-dependencies option; maybe it still should? Note also that @@ -78,6 +73,9 @@ Clean up the output: * regularize how backslash-newline is done. Just one space between text and backslash should be the rule. Update makefile-mode to allow this. (set column to 0, probably) +Omit program transform vars from header if no program installed. This +is currently pretty hard to do. (But with beautification code it +would probably be easy) It should be possible to have ansi2knr in just one place in a package. Jim Meyering says just rely on configure to make links as appropriate. diff --git a/automake.in b/automake.in index b33a7b7..2bad733 100755 --- a/automake.in +++ b/automake.in @@ -501,13 +501,44 @@ sub handle_source_transform local ($objpat) = $obj; $objpat =~ s/(\W)/\\$1/g; - # Look for file_SOURCES and file_OBJECTS. - if (defined $contents{$one_file . "_SOURCES"}) + if (defined $contents{$one_file . "_OBJECTS"}) { - if (! defined $contents{$one_file . "_OBJECTS"}) + &am_line_error ($one_file . '_OBJECTS', + $one_file . '_OBJECTS', 'should not be defined'); + # No point in continuing. + return; + } + + local ($source_list); + local ($prefix); + foreach $prefix ('', 'EXTRA_') + { + $source_list = ''; + if (defined $contents{$prefix . $one_file . "_SOURCES"}) + { + push (@sources, '$(' . $prefix . $one_file . "_SOURCES)"); + push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)") + unless $prefix eq 'EXTRA_'; + $source_list = $contents{$prefix . $one_file . "_SOURCES"}; + } + elsif ($prefix eq '') + { + $output_vars .= ($one_file . "_SOURCES = " . $one_file . ".c\n" + . $one_file . "_OBJECTS = ". $one_file + . $obj . "\n"); + push (@sources, $one_file . '.c'); + push (@objects, $one_file . $obj); + $source_list = $one_file . ".c "; + } + else + { + $output_vars .= "EXTRA_" . $one_file . "_SOURCES =\n"; + } + + if ($source_list) { # Turn sources into objects. - local (@files) = split (/\s+/, $contents{$one_file . "_SOURCES"}); + local (@files) = split (/\s+/, $source_list); local (@result) = (); foreach (@files) { @@ -539,7 +570,8 @@ sub handle_source_transform s/\.cc$/$obj/g; s/\.cxx$/$obj/g; s/\.[cCmylfs]$/$obj/g; - push (@result, $_); + push (@result, $_) + unless $prefix eq 'EXTRA_'; # Transform .o or $o file into .P file (for automatic # dependency code). @@ -547,25 +579,9 @@ sub handle_source_transform $dep_files{'$(srcdir)/.deps/' . $_} = 1; } - &pretty_print ($one_file . "_OBJECTS =", "", @result); - } - else - { - &am_line_error ($one_file . '_OBJECTS', - $one_file . '_OBJECTS', 'should not be defined'); + &pretty_print ($one_file . "_OBJECTS =", "", @result) + unless $prefix eq 'EXTRA_'; } - - push (@sources, '$(' . $one_file . "_SOURCES)"); - push (@objects, '$(' . $one_file . "_OBJECTS)"); - } - else - { - $output_vars .= ($one_file . "_SOURCES = " . $one_file . ".c\n" - . $one_file . "_OBJECTS = ". $one_file - . $obj . "\n"); - push (@sources, $one_file . '.c'); - push (@objects, $one_file . $obj); - $dep_files{'$(srcdir)/.deps/' . $one_file . '.P'} = 1; } if (defined $contents{'CONFIG_HEADER'}) @@ -1135,12 +1151,12 @@ sub handle_dist_worker '; } - # If the target `dist-local' exists, run it now. This allows + # 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-local'}) + if (defined $contents{'dist-hook'}) { - $output_rules .= "\t\$(MAKE) dist-local\n"; + $output_rules .= "\t\$(MAKE) dist-hook\n"; } # Finalize. @@ -1648,13 +1664,23 @@ sub handle_merge_targets # Step three: print definitions users can use. $output_rules .= ("install-exec: " . join (' ', @install_exec) - . "\n\n"); + . "\n"); + if (defined $contents{'install-exec-hook'}) + { + $output_rules .= "\t" . '$(MAKE) install-exec-hook' . "\n"; + } + $output_rules .= "\n"; push (@install, 'install-exec') if !$recursive_install; push (@phony, 'install-exec'); $output_rules .= ("install-data: " . join (' ', @install_data) - . "\n\n"); + . "\n"); + if (defined $contents{'install-data-hook'}) + { + $output_rules .= "\t" . '$(MAKE) install-data-hook' . "\n"; + } + $output_rules .= "\n"; push (@install, 'install-data') if !$recursive_install; push (@phony, 'install-data'); diff --git a/automake.texi b/automake.texi index d87f69c..2bc9db7 100644 --- a/automake.texi +++ b/automake.texi @@ -1007,13 +1007,13 @@ the @code{EXTRA_DIST} variable. @vindex EXTRA_DIST Occasionally it is useful to be able to change the distribution before -it is packaged up. If the @code{dist-local} target exists, it is run +it is packaged up. If the @code{dist-hook} target exists, it is run after the distribution directory is filled, but before the actual tar (or shar) file is created. One way to use this is for distributing file in subdirectories for which a new @file{Makefile.am} is overkill: @example -dist-local: +dist-hook: mkdir $(distdir)/random cp -p random/a1 random/a2 $(distdir)/random @end example @@ -1172,6 +1172,21 @@ install-data-local: $(INSTALL_DATA) $(srcdir)/afile /etc/afile @end example +Some targets also have a way to run another target, called a @dfn{hook}, +after their work is done. The hook is named after the principal target, +with @samp{-hook} appended. The targets allowing hooks are +@code{install-data}, @code{install-exec}, and @code{dist}. +@trindex install-data-hook +@trindex install-exec-hook +@trindex dist-hook + +For instance, here is how to create a hard link to an installed program: + +@example +install-exec-hook: + $(LN) $(bindir)/program $(bindir)/proglink +@end example + @c FIXME should include discussion of variables you can use in these @c rules diff --git a/lib/mkinstalldirs b/lib/mkinstalldirs index 0801ec2..cc8783e 100755 --- a/lib/mkinstalldirs +++ b/lib/mkinstalldirs @@ -20,7 +20,11 @@ for file in ${1+"$@"} ; do if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr fi pathcomp="$pathcomp/" diff --git a/mkinstalldirs b/mkinstalldirs index 0801ec2..cc8783e 100755 --- a/mkinstalldirs +++ b/mkinstalldirs @@ -20,7 +20,11 @@ for file in ${1+"$@"} ; do if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" || errstatus=$? + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr fi pathcomp="$pathcomp/" diff --git a/version.texi b/version.texi index 221774a..c300307 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 28 March 1996 +@set UPDATED 4 April 1996 @set EDITION 0.32 @set VERSION 0.32 -- 2.7.4