From: Tom Tromey Date: Fri, 9 Apr 1999 23:05:48 +0000 (+0000) Subject: * automake.in (handle_source_transform): Handle dist and nodist X-Git-Tag: last-merge-into-user-dep-gen-branch~34 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=9125f627db2603bf7e2ddea523f587b96e6da929;p=automake.git * automake.in (handle_source_transform): Handle dist and nodist prefixes. (initialize_per_input): Initialize dist_sources. (check_libobjs_sources): Handle dist and nodist prefixes. (generate_makefile): Define DIST_SOURCES. * dist-vars.am (DISTFILES): Reference DIST_SOURCES, not SOURCES. --- diff --git a/ChangeLog b/ChangeLog index 4e20f6e0..e2e2e17d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 1999-04-09 Tom Tromey + * automake.in (handle_source_transform): Handle dist and nodist + prefixes. + (initialize_per_input): Initialize dist_sources. + (check_libobjs_sources): Handle dist and nodist prefixes. + (generate_makefile): Define DIST_SOURCES. + * dist-vars.am (DISTFILES): Reference DIST_SOURCES, not SOURCES. + * automake.texi (Macros): Mention AM_PROG_GCJ. (Java Support): New node. (Dist): Documented dist_ and nodist_ prefixes. diff --git a/NEWS b/NEWS index c17b2fc9..2d3b5407 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,9 @@ New in 1.4a: * Many files (but not all) are correctly handled if they appear in subdirs For instance, a _DATA file can appear in a subdir * GNU tar is no longer required for `make dist' -* The usual bug fixes -* Added support for `dist_' and `nodist_' prefixes to some primaries +* Added support for `dist_' and `nodist_' prefixes * Compiled Java support +* The usual bug fixes New in 1.4: * Added support for the Fortran 77 programming language. diff --git a/automake.in b/automake.in index 43a03d68..9ccf3a62 100755 --- a/automake.in +++ b/automake.in @@ -627,6 +627,7 @@ sub generate_makefile # on this (but currently does). $contents{'SOURCES'} = join (' ', @sources); $contents{'OBJECTS'} = join (' ', @objects); + &define_pretty_variable ('DIST_SOURCES', '', @dist_sources); &handle_multilib; &handle_texinfo; @@ -1023,7 +1024,8 @@ sub check_libobjs_sources local ($one_file, $unxformed) = @_; local ($prefix, $file, @files); - foreach $prefix ('', 'EXTRA_') + foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_', + 'dist_EXTRA_', 'nodist_EXTRA_') { if (&variable_defined ($prefix . $one_file . '_SOURCES')) { @@ -1196,16 +1198,29 @@ sub handle_source_transform return; } - local (@files, @result, $prefix, $temp); - foreach $prefix ('', 'EXTRA_') + local (@files, @result, $prefix, $temp, $xpfx); + local (%used_pfx) = (); + foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_', + 'dist_EXTRA_', 'nodist_EXTRA_') { + # We are going to define _OBJECTS variables using the prefix. + # Then we glom them all together. So we can't use the null + # prefix here as we need it later. + $xpfx = ($prefix eq '') ? 'am_' : $prefix; + @files = (); local ($var) = $prefix . $one_file . "_SOURCES"; if (&variable_defined ($var)) { + # Keep track of which prefixes we saw. + $used_pfx{$xpfx} = 1 + unless $prefix =~ /EXTRA_/; + push (@sources, '$(' . $prefix . $one_file . "_SOURCES)"); - push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)") - unless $prefix eq 'EXTRA_'; + push (@objects, '$(' . $xpfx . $one_file . "_OBJECTS)") + unless $prefix =~ /EXTRA_/; + push (@dist_sources, '$(' . $prefix . $one_file . "_SOURCES)") + unless $prefix =~ /^nodist_/; local (@conds) = &variable_conditions ($var); if (! @conds) { @@ -1222,26 +1237,34 @@ sub handle_source_transform $linker = $temp if $linker eq ''; # Define _OBJECTS conditionally. - &define_pretty_variable ($one_file . '_OBJECTS', $cond, - @result) - unless $prefix eq 'EXTRA_'; + &define_pretty_variable ($xpfx . $one_file . '_OBJECTS', + $cond, @result) + unless $prefix =~ /EXTRA_/; } next; } } - elsif ($prefix eq '') - { - &define_variable ($one_file . "_SOURCES", $unxformed . ".c"); - push (@sources, $unxformed . '.c'); - push (@objects, $unxformed . $obj); - push (@files, $unxformed . '.c'); - } ($temp, @result) = &handle_single_transform_list ($obj, @files); $linker = $temp if $linker eq ''; - &define_pretty_variable ($one_file . "_OBJECTS", '', @result) - unless $prefix eq 'EXTRA_'; + &define_pretty_variable ($xpfx . $one_file . "_OBJECTS", '', @result) + unless $prefix =~ /EXTRA_/; + } + + local (@keys) = sort keys %used_pfx; + if (scalar @keys == 0) + { + &define_variable ($one_file . "_SOURCES", $unxformed . ".c"); + push (@sources, $unxformed . '.c'); + push (@dist_sources, $unxformed . '.c'); + push (@objects, $unxformed . $obj); + push (@files, $unxformed . '.c'); + } + else + { + grep ($_ = '$(' . $_ . $one_file . '_OBJECTS)', @keys); + &define_pretty_variable ($one_file . '_OBJECTS', '', @keys); } return $linker; @@ -6529,6 +6552,8 @@ sub initialize_per_input # SOURCES and OBJECTS variables. @sources = (); @objects = (); + # Sources which go in the distribution. + @dist_sources = (); # This hash maps object file names onto their corresopnding source # file names. This is used to ensure that each object is created diff --git a/dist-vars.am b/dist-vars.am index 3d40a79b..ee1c902e 100644 --- a/dist-vars.am +++ b/dist-vars.am @@ -19,4 +19,4 @@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ ## DIST_COMMON comes first so that README can be the very first file. -DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEXINFOS) $(EXTRA_DIST) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)