From 0e6da896dc6c4b1b4d9a34e7649beab2c6a6910f Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 21 Jan 2003 18:02:32 +0000 Subject: [PATCH] * lib/am/distdir.am (top_distdir, distdir): Define these variables only in top level Makefile. Redefine $(top_distdir) as $(distdir). (distdir): Fix passing of $(top_distdir) to sub-makes. * automake.in (handle_dist): Do not define the DISTDIR and TOP_DISTDIR transformations. We don't need them anymore. * automake.texi (Dist): Reorder the dist-hook section, and move the DIST_SUBDIRS paragraph earlier. Document distdir and top_distdir. * tests/subpkg.test: Update to check for $(distdir) and $(top_distdir). --- ChangeLog | 14 +++++++++++ NEWS | 6 +++++ automake.in | 4 --- automake.texi | 63 ++++++++++++++++++++++++++++++++--------------- lib/am/distdir.am | 19 ++++++-------- stamp-vti | 2 +- tests/subpkg.test | 17 ++++++++++++- version.texi | 2 +- 8 files changed, 88 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b5e7665..ebf74360 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-01-21 Alexandre Duret-Lutz + + * lib/am/distdir.am (top_distdir, distdir): Define these + variables only in top level Makefile. Redefine $(top_distdir) + as $(distdir). + (distdir): Fix passing of $(top_distdir) to sub-makes. + * automake.in (handle_dist): Do not define the DISTDIR and + TOP_DISTDIR transformations. We don't need them anymore. + * automake.texi (Dist): Reorder the dist-hook section, and move + the DIST_SUBDIRS paragraph earlier. Document distdir and + top_distdir. + * tests/subpkg.test: Update to check for $(distdir) and + $(top_distdir). + 2003-01-19 Alexandre Duret-Lutz Rename more files to accomodate 8+3 file systems, and adjust the diff --git a/NEWS b/NEWS index e1c9e2d0..19a01cae 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,10 @@ New in 1.7a: +* Cleanup the definitions of $(distdir) and $(top_distdir). + $(top_distdir) now points to the root of the distribution directory + created during `make dist', as it did in Automake 1.4, not to the + root of the build tree as it did in intervening versions. + Furthermore these two variables are now only defined in the top + level Makefile, and passed to sub-directories when running `make dist'. * elisp sources are compiled all at once, instead of one by one. This allows interdependencies and speed up compilation. * AM_PROG_CC_STDC is now empty. The content of this macro was diff --git a/automake.in b/automake.in index f5995965..6086e004 100755 --- a/automake.in +++ b/automake.in @@ -4175,10 +4175,6 @@ sub handle_dist if &target_defined ('dist-hook'); $transform{'DIST-TARGETS'} = join(' ', @dist_targets); - # Defining $(DISTDIR). - $transform{'DISTDIR'} = !variable_defined('distdir'); - $transform{'TOP_DISTDIR'} = backname ($relative_dir); - $output_rules .= &file_contents ('distdir', new Automake::Location, %transform); diff --git a/automake.texi b/automake.texi index 49505d5b..b6702089 100644 --- a/automake.texi +++ b/automake.texi @@ -4371,9 +4371,18 @@ entire directory will be recursively copied into the distribution. Please note that this will also copy @emph{everything} in the directory, including CVS/RCS version control files. We recommend against using this feature. - @vindex EXTRA_DIST +If you define @code{SUBDIRS}, Automake will recursively include the +subdirectories in the distribution. If @code{SUBDIRS} is defined +conditionally (@pxref{Conditionals}), Automake will normally include all +directories that could possibly appear in @code{SUBDIRS} in the +distribution. If you need to specify the set of directories +conditionally, you can set the variable @code{DIST_SUBDIRS} to the exact +list of subdirectories to include in the distribution (@pxref{Top level}). +@vindex DIST_SUBDIRS + + @section Fine-grained distribution control Sometimes you need tighter control over what does @emph{not} go into the @@ -4398,25 +4407,6 @@ nodist_foo_SOURCES = do-not-distribute.c @section The dist hook -Another way to to use this is for removing unnecessary files that get -recursively included by specifying a directory in EXTRA_DIST: - -@example -EXTRA_DIST = doc - -dist-hook: - rm -rf `find $(distdir)/doc -name CVS` -@end example - -If you define @code{SUBDIRS}, Automake will recursively include the -subdirectories in the distribution. If @code{SUBDIRS} is defined -conditionally (@pxref{Conditionals}), Automake will normally include all -directories that could possibly appear in @code{SUBDIRS} in the -distribution. If you need to specify the set of directories -conditionally, you can set the variable @code{DIST_SUBDIRS} to the exact -list of subdirectories to include in the distribution. -@vindex DIST_SUBDIRS - @trindex dist-hook Occasionally it is useful to be able to change the distribution before @@ -4431,6 +4421,39 @@ dist-hook: cp -p $(srcdir)/random/a1 $(srcdir)/random/a2 $(distdir)/random @end example +Another way to to use this is for removing unnecessary files that get +recursively included by specifying a directory in EXTRA_DIST: + +@example +EXTRA_DIST = doc + +dist-hook: + rm -rf `find $(distdir)/doc -name CVS` +@end example + +@vindex distdir +@vindex top_distdir +Two variables that come handy when writting @code{dist-hook} targets are +@code{$(distdir)} and @code{$(top_distdir)}. + +@code{$(distdir)} points to the directory where the @code{dist} target +will copy files from the current directory before creating the +tarball. If you are at the top-level directory, then @code{distdir = +$(PACKAGE)-$(VERSION)}. When used from subdirectory named +@file{foo/}, then @code{distdir = ../$(PACKAGE)-$(VERSION)/foo}. + +@code{$(top_distdir)} always points to the root directory of the +distributed tree. At the top-level it's equal to @code{$(distdir)}. +In the @file{foo/} subdirectory +@code{top_distdir = ../$(PACKAGE)-$(VERSION)}. + +Note that when packages are nested using @code{AC_CONFIG_SUBDIRS} +(@pxref{Subdirectories, AC_CONFIG_SUBDIRS, Configuring Other Packages +in Subdirectories, autoconf, The Autoconf Manual}), then +@code{$(distdir)} and @code{$(top_distdir)} are relative to the +package where @code{make dist} was run, not to any sub-packages +involved. + @section Checking the distribution @cindex make distcheck diff --git a/lib/am/distdir.am b/lib/am/distdir.am index bc503147..f4a26ef6 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2002 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -19,15 +19,10 @@ ## DIST_COMMON comes first so that README can be the very first file. DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -top_distdir = %TOP_DISTDIR% if %?TOPDIR_P% -## Avoid unsightly `./'. -?DISTDIR?distdir = $(PACKAGE)-$(VERSION) -else !%?TOPDIR_P% -?DISTDIR?distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) -endif !%?TOPDIR_P% +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) -if %?TOPDIR_P% am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ @@ -157,13 +152,13 @@ endif %?TOPDIR_P% if %?SUBDIRS% list='$(%DIST_SUBDIR_NAME%)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -d "$(distdir)/$$subdir" \ + || mkdir "$(distdir)/$$subdir" \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="../$(top_distdir)" \ + distdir="../$(distdir)/$$subdir" \ distdir) \ || exit 1; \ fi; \ diff --git a/stamp-vti b/stamp-vti index 4aceec33..ce005916 100644 --- a/stamp-vti +++ b/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2003 +@set UPDATED 21 January 2003 @set UPDATED-MONTH January 2003 @set EDITION 1.7a @set VERSION 1.7a diff --git a/tests/subpkg.test b/tests/subpkg.test index d2ed1020..84b23067 100755 --- a/tests/subpkg.test +++ b/tests/subpkg.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -36,6 +36,14 @@ SUBDIRS = lib # Yes, This program is named LDADD. So what? bin_PROGRAMS = LDADD LDADD_LDADD = lib/liblib.a + +# It's ok to override distdir. +distdir = subpack-1 + +# Make sure $(distdir) and $(top_distdir) work as expected. +dist-hook: + test -f $(distdir)/LDADD.c + test -f $(top_distdir)/LDADD.c EOF cat >LDADD.c <<'EOF' @@ -63,6 +71,12 @@ EOF cat >lib/Makefile.am <<'EOF' noinst_LIBRARIES = liblib.a liblib_a_SOURCES = src/x.c + +dist-hook: + test ! -f $(distdir)/LDADD.c + test -f $(top_distdir)/LDADD.c + test -f $(distdir)/src/x.c + test ! -f $(top_distdir)/src/x.c EOF cat >lib/src/x.c <<'EOF' @@ -84,3 +98,4 @@ cd .. ./configure $MAKE distcheck +test -f subpack-1.tar.gz diff --git a/version.texi b/version.texi index 4aceec33..ce005916 100644 --- a/version.texi +++ b/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 19 January 2003 +@set UPDATED 21 January 2003 @set UPDATED-MONTH January 2003 @set EDITION 1.7a @set VERSION 1.7a -- 2.43.5