Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

4.7.5 Automatic Remaking

You can put rules like the following in the top-level Makefile.in for a package to automatically update the configuration information when you change the configuration files. This example includes all of the optional files, such as aclocal.m4 and those related to configuration header files. Omit from the Makefile.in rules for any of these files that your package does not use.

The ‘$(srcdir)/’ prefix is included because of limitations in the VPATH mechanism.

The stamp- files are necessary because the timestamps of config.h.in and config.h are not changed if remaking them does not change their contents. This feature avoids unnecessary recompilation. You should include the file stamp-h.in your package's distribution, so that make considers config.h.in up to date. Don't use touch (see Limitations of Usual Tools); instead, use echo (using date would cause needless differences, hence CVS conflicts, etc.).

     $(srcdir)/configure: configure.ac aclocal.m4
             cd '$(srcdir)' && autoconf
     
     # autoheader might not change config.h.in, so touch a stamp file.
     $(srcdir)/config.h.in: stamp-h.in
     $(srcdir)/stamp-h.in: configure.ac aclocal.m4
             cd '$(srcdir)' && autoheader
             echo timestamp > '$(srcdir)/stamp-h.in'
     
     config.h: stamp-h
     stamp-h: config.h.in config.status
             ./config.status
     
     Makefile: Makefile.in config.status
             ./config.status
     
     config.status: configure
             ./config.status --recheck

(Be careful if you copy these lines directly into your makefile, as you need to convert the indented lines to start with the tab character.)

In addition, you should use

     AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])

so config.status ensures that config.h is considered up to date. See Output, for more information about AC_OUTPUT.

See config.status Invocation, for more examples of handling configuration-related dependencies.


 
 
  Published under the terms of the GNU General Public License Design by Interspire