bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "make dist" fails if I delete the dummy ChangeLog


From: Jim Meyering
Subject: Re: "make dist" fails if I delete the dummy ChangeLog
Date: Thu, 13 Oct 2011 09:42:22 +0200

Stefano Lattarini wrote:
> On my Debian GNU/Linux system:
>
>   $ cd ~/src/grep
>   $ rm -f ChangeLog
>   $ make dist
>   make: *** No rule to make target `ChangeLog', needed by `distdir'.  Stop.
>   $ make
>     GEN    gen-ChangeLog
>   /bin/sh: line 2: grep-2.9.63-88b2-dirty/cl-t: No such file or directory
>   mv: cannot stat `grep-2.9.63-88b2-dirty/cl-t': No such file or directory
>   make: *** [gen-ChangeLog] Error 1
>
> This could all be solved by re-creating the dummy `ChangeLog' file (a simple
> "touch ChangeLog" is enough), but I dislike the idea that we have to create
> an empty, dummy file in order to allow the real file to be created at "make
> dist" time (and only then).  The attached patch tries to improve the
> situation.  Of course, I understand that you might prefer the current setup
> over the one my patch implements, so feel free to just reject the patch; I'm
> sending it over anyway, in the hope you might share my preferences on this
> matter.
...

Thanks for the patch.
I like the idea, but would rather have the new rule in a separate,
"include"d file, which would make it easier to share and keep up to date.

A couple of comments in-line:

> Subject: [PATCH] dist: better automatic generation of ChangeLog
>
> * Makefile.am (gen-ChangeLog): Removed, superseded by ...
> (ChangeLog): ... this new .PHONY target, that takes care of
> creating the ChangeLog in the builddir rather than in the
> distdir.
> (dist-hook): Don't depend on `gen-ChangeLog' anymore.
> * bootstrap.conf: Don't generate a dummy ChangeLog file
> anymore, it's no more needed.
> ---
>  Makefile.am    |   29 ++++++++++++++++++++---------
>  bootstrap.conf |    3 ---
>  2 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index a13f262..24624f3 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -35,15 +35,26 @@ run-syntax-check:
>
>  # Arrange so that .tarball-version appears only in the distribution
>  # tarball, and never in a checked-out repository.
> -dist-hook: gen-ChangeLog run-syntax-check
> +dist-hook: run-syntax-check
>       $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
>
>  gen_start_date = 2009-11-27
> -.PHONY: gen-ChangeLog
> -gen-ChangeLog:
> -     $(AM_V_GEN)if test -d .git; then                                \
> -       $(top_srcdir)/build-aux/gitlog-to-changelog                   \
> -         --since=$(gen_start_date) > $(distdir)/cl-t;                \
> -       rm -f $(distdir)/ChangeLog;                                   \
> -       mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
> -     fi
> +.PHONY: ChangeLog
> +ChangeLog:
> +     $(AM_V_GEN)rm -f address@hidden || exit 1; \
> +     if test -d $(srcdir)/.git; then \
> +       $(top_srcdir)/build-aux/gitlog-to-changelog \
> +         --since=$(gen_start_date) > address@hidden; \
> +## We want to support "make dist" also from distribution tarballs.  In
> +## case of a VPATH build, prefer any ChangeLog in the build dir to the
> +## one in the source dir (in the spirit of VPATH).
> +     elif test -f $@; then \
> +       cp -f $@ address@hidden; \
> +     elif test -f $(srcdir)/'$@'; then \
> +       cp -f $(srcdir)/'$@' address@hidden; \

Why add single quotes above?

I find it more readable to align the backslashes.
Also, if one is missing, say on a just-added line, it's far easier to spot.

> +     else \
> +       echo "Source tree is not a git checkout, and no" \
> +            "pre-existent ChangeLog file has been found" >&2; \
> +       exit 1; \
> +     fi; \

Don't you mean this:

        fi && \

so that if any of the above fail we don't end up with
a corrupted ChangeLog file?

> +     chmod a-w address@hidden && mv -f address@hidden $@
> diff --git a/bootstrap.conf b/bootstrap.conf
> index c3b7158..9bfd16c 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -98,9 +98,6 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
>   --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
>  '
>
> -# Automake requires that ChangeLog exist.
> -test -f ChangeLog || touch ChangeLog || exit 1
> -
>  gnulib_tool_option_extras="--tests-base=$bt/gnulib-tests --with-tests"
>
>  # Build prerequisites



reply via email to

[Prev in Thread] Current Thread [Next in Thread]