Re: [PATCH] Makefile: don't include git version file on 'make clean'

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

 



On Sun, Jul 25, 2010 at 12:37,  <lynn.lin@xxxxxxx> wrote:
>
>
> -----Original Message-----
> From: Ævar Arnfjörð Bjarmason [mailto:avarab@xxxxxxxxx]
> Sent: 2010年7月25日 20:34
> To: Lin, Lynn
> Cc: schwab@xxxxxxxxxxxxxx; kpfleming@xxxxxxxxxx; git@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] Makefile: don't include git version file on 'make clean'
>
> On Sun, Jul 25, 2010 at 12:29,  <lynn.lin@xxxxxxx> wrote:
>
>> My patch is to don't call GIT-VERSION-FILE target when you run 'make clean'
>
> Yes, but as I demonstrated it gets called anyway. Presumably because
> of the $(MAKE) -C ... clean rules. But I haven't looked into it.
>
>
> If we don't specify special goals, when we run any target ,it will call GIT-VERSIONF-FILE target as it include this target
>
> Example from GNU make manual:
> http://www.gnu.org/software/autoconf/manual/make/Goals.html
>
>
> An example of appropriate use is to avoid including .d files during clean rules (see Automatic Prerequisites), so make won't create them only to immediately remove them again:
>
>          sources = foo.c bar.c
>
>     ifneq ($(MAKECMDGOALS),clean)
>     include $(sources:.c=.d)
>     endif

Yes, I know (now) how include directives work. What I'm saying is that
your patch doesn't work because the main Makefile clean directive
calls *other* makefiles, which in turn include the version file:

    $ rm GIT-VERSION-FILE ; make -C gitweb clean; cat GIT-VERSION-FILE
    make: Entering directory `/home/avar/g/git/gitweb'
    make[1]: Entering directory `/home/avar/g/git'
    GIT_VERSION = 1.7.2.6.g65a0d3
    make[1]: Leaving directory `/home/avar/g/git'
    make[1]: Entering directory `/home/avar/g/git'
    make[1]: `GIT-VERSION-FILE' is up to date.
    make[1]: Leaving directory `/home/avar/g/git'
    make: Leaving directory `/home/avar/g/git/gitweb'
    make: Entering directory `/home/avar/g/git/gitweb'
    make[1]: Entering directory `/home/avar/g/git'
    make[1]: `GIT-VERSION-FILE' is up to date.
    make[1]: Leaving directory `/home/avar/g/git'
    rm -f gitweb.cgi static/gitweb.min.js static/gitweb.min.css
GITWEB-BUILD-OPTIONS
    make: Leaving directory `/home/avar/g/git/gitweb'
    GIT_VERSION = 1.7.2.6.g65a0d3

So just removing the inclusion in the main Makefile doesn't do
anything at all.

To get it to work you need to patch the */Makefile files too, and
patch other clean targets like distclean.

But personally I think this whole thing is a bit silly, but others may
disagree. I've said my bit.

Thanks for contributing to Git anyway, your help is appreciated.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]