
Jim Meyering wrote:
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way:
Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options.
IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make".
Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you.
[currently this works only from a srcdir build]
In case you don't mind that and the "run autogen.sh with no options" restriction, here's a complete patch:
From c0a350326f00e1707df47abd6ef3d8fa24841456 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 10:01:04 +0200 Subject: [PATCH] build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the gnulib git submodule, you must rerun the bootstrap and autogen.sh script. With this change, it's done via rules included into GNUmakefile. * cfg.mk: Maintain a new file, .git-module-status, containing the current submodule status. If it doesn't exist or its content is different from what "git submodule status" prints, then rerun ./bootstrap and ./autogen.sh. * .gitignore: Add .git-module-status --- .gitignore | 1 + cfg.mk | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 54c3ba4..17c3975 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *~ .git +.git-module-status ABOUT-NLS COPYING INSTALL diff --git a/cfg.mk b/cfg.mk index 736f7c0..8750751 100644 --- a/cfg.mk +++ b/cfg.mk @@ -230,3 +230,16 @@ sc_libvirt_unmarked_diagnostics: # We don't use this feature of maint.mk. prev_version_file = /dev/null + +ifeq (0,$(MAKELEVEL)) + _curr_status = .git-module-status + __dummy := $(warn MAKELEVEL = $(MAKELEVEL)) + _submodule_check := \ + $(shell t=$$(git submodule status); \ + test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)" \ + || { test -w /dev/tty && echo running bootstrap...>/dev/tty; \ + ./bootstrap && echo "$$t" > $(_curr_status); \ + test -w /dev/tty && echo running autogen.sh...>/dev/tty; \ + ./autogen.sh; \ + }) +endif -- 1.6.3.3.524.g8586b