Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AA64A431FBD for ; Sun, 6 Jul 2014 12:50:43 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id abej6oNs7c5Q for ; Sun, 6 Jul 2014 12:50:35 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 9EAF0431FAF for ; Sun, 6 Jul 2014 12:50:35 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 289DB10008F; Sun, 6 Jul 2014 22:50:26 +0300 (EEST) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH] build: check .git directory existence in srcdir (for out-of-tree builds) In-Reply-To: <874mywroni.fsf@maritornes.cs.unb.ca> References: <1399404928-15471-1-git-send-email-tomi.ollila@iki.fi> <874mywroni.fsf@maritornes.cs.unb.ca> User-Agent: Notmuch/0.18.1+25~gdaf4b6f (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2014 19:50:43 -0000 On Sat, Jul 05 2014, David Bremner wrote: > Tomi Ollila writes: > >> So that $(VERSION) and version.stamp uses the git-describe -based >> version data instead of the content of `version' file. >> >> For consistency also the git commands in Makefile[.local] target >> `verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ... >> commands (inside ifeq($(IS_GIT),yes)). Attempting to make this >> target outside of the tree will fail in any case. > > This seems to work OK; I wondered if an alternate method of setting (and > exporting) GIT_DIR from the top level makefile would work as well, and > be less intrusive? This looked like a good idea, and I tested it. But -- lo and behold -- the environment variables set in Makefile do not probagate to the commands executed with $(shell ...) -- see (*) (I wrapped git(1) in a shell script (executes env then execs real git) to verify this is still the case). I thoght now a bit whether we'd use variable in place of ${srcdir}/.git but IMHO is better in this way: - make does not have option to warn/die in case variable undefined, it is then just empty string so no internal error checking there - any human observer notices from the ${srcdir}/.git that we're not using git from any nonstandard place -- if there were variable one would have needed to dereference that to figure out this is the case. (*) http://www.cmcrossroads.com/article/basics-getting-environment-variables-gnu-make?page=0%2C1 > > d Tomi