summaryrefslogtreecommitdiff
path: root/lib/am/distdir.am
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-03-07 09:00:19 +0100
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-03-07 09:00:19 +0100
commit31a0b6b54782f24dd7ed84d257095078c1d6e937 (patch)
tree807315577190ac178389a079cb2334ba3190ac85 /lib/am/distdir.am
parentf55440a1497d8653b01324d74a4418a1847146f6 (diff)
downloadautomake-31a0b6b54782f24dd7ed84d257095078c1d6e937.tar.gz
Improve `make -n dist' and `make -n distcheck' for GNU make.
Ensure that `make -n dist' and `make -n distcheck' do not change files, due to GNU make executing rules containing `$(MAKE)'. * lib/am/distdir.am (distdir): Separate the creation of `$(distdir)/$$subdir' for `$(DIST_SUBDIRS)' and the recursion into the `$(DIST_SUBDIRS)' in two separate rule commands. (distcheck): Exit recursive rule early when run with `make -n', as detected by a witness file. * tests/maken.test, tests/maken2.test: New tests. * tests/Makefile.am: Update. * NEWS: Update. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'lib/am/distdir.am')
-rw-r--r--lib/am/distdir.am12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 5acfa493f..ad5e7713c 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -220,12 +220,18 @@ endif %?TOPDIR_P%
## directory, then we use `distdir' instead of `top_distdir'; this lets
## us work correctly with an enclosing package.
##
+## Split the loop for the directory creation and the one for recursion,
+## so that with GNU make -n, only the latter is executed.
if %?SUBDIRS%
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
@@ -418,6 +424,12 @@ distcheck: dist
mkdir $(distdir)/_inst
## Undo the write access.
chmod a-w $(distdir)
+## With GNU make, the following command will be executed even with `make -n',
+## due to the presence of `$(MAKE)'. That is normally all well (and `$(MAKE)'
+## is necessary for things like parallel distcheck), but here we don't want
+## execution. To avoid MAKEFLAGS parsing hassles, use a witness file that a
+## non-`-n' run would have just created.
+ test -d $(distdir)/_build || exit 0; \
## Compute the absolute path of `_inst'. Strip any leading DOS drive
## to allow DESTDIR installations. Otherwise "$(DESTDIR)$(prefix)" would
## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst".