autoconf: Automatic Remaking

1 
1 4.8.5 Automatic Remaking
1 ------------------------
1 
1 You can put rules like the following in the top-level `Makefile.in' for
1 a package to automatically update the configuration information when
1 you change the configuration files.  This example includes all of the
1 optional files, such as `aclocal.m4' and those related to configuration
1 header files.  Omit from the `Makefile.in' rules for any of these files
1 that your package does not use.
1 
1    The `$(srcdir)/' prefix is included because of limitations in the
1 `VPATH' mechanism.
1 
1    The `stamp-' files are necessary because the timestamps of
1 `config.h.in' and `config.h' are not changed if remaking them does not
1 change their contents.  This feature avoids unnecessary recompilation.
1 You should include the file `stamp-h.in' in your package's
1 distribution, so that `make' considers `config.h.in' up to date.  Don't
1 use `touch' (⇒Limitations of Usual Tools touch.); instead, use
1 `echo' (using `date' would cause needless differences, hence CVS
1 conflicts, etc.).
1 
1      $(srcdir)/configure: configure.ac aclocal.m4
1              cd '$(srcdir)' && autoconf
1 
1      # autoheader might not change config.h.in, so touch a stamp file.
1      $(srcdir)/config.h.in: stamp-h.in
1      $(srcdir)/stamp-h.in: configure.ac aclocal.m4
1              cd '$(srcdir)' && autoheader
1              echo timestamp > '$(srcdir)/stamp-h.in'
1 
1      config.h: stamp-h
1      stamp-h: config.h.in config.status
1              ./config.status
1 
1      Makefile: Makefile.in config.status
1              ./config.status
1 
1      config.status: configure
1              ./config.status --recheck
1 
1 (Be careful if you copy these lines directly into your makefile, as you
1 need to convert the indented lines to start with the tab character.)
1 
1    In addition, you should use
1 
1      AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1 
1 so `config.status' ensures that `config.h' is considered up to date.
1 ⇒Output, for more information about `AC_OUTPUT'.
1 
1    ⇒config.status Invocation, for more examples of handling
1 configuration-related dependencies.
1