Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

a newbie question about autoconf&automake

Hi,

   How to setup configure.in so that compiler compile only files that have been updated?


stephen
0
zollen
Asked:
zollen
1 Solution
 
blytkerchanCommented:
autoconf is not the one that checks which files are updated and which aren't - that's Make's job.

Once you've set up a configure.ac (or configure.in) file for your project, (and, if you want to use automake, a Makefile.am file) you can run the following to "bootstrap"

$ aclocal
(which sets up aclocal.m4 which autoconf will use)

$ autoheader
(if you use a config.h file, this will generate config.h.in for you)

$ autoconf
(this will generate the configure script for you)

$ automake --add-missing --foreign --copy
(this will generate the Makefile.in from the Makefile.am)

If you don't want to use automake, you'll have to make a Makefile.in file yourself. The --add-missing option will copy any needed & missing files (the --copy makes it copy, without it there will be symlinks, which will work too); the --foreign supresses the need of strictly adhering to the GNU coding standards.

Once you've done that, you can run ./configure to configure your compilation - which means a Makefile will be generated and, if you've chosen to have one generated, a config.h file will be generated as well. After that, (and this is the answer you were apparently looking for) you run
$ make
any time you want to re-compile. You don't do the whole bootstrap & configure again because that will outdate all your source files - you only do that if you need to (and, if you use automake, it will be done automagically). Make will look which files are out of date and re-build whatever they depend on.

Now, for the contents of your configure.in file, you don't really need much. You might want to use
$ autoscan
to get the skeleton of a configure.in file with most of the checks you will beed.

As for your Makefile.am file, you can do something like this:

bin_PROGRAMS=foo
foo_SOURCES=foo.c bar.c
foo_HEADERS=foo.c bar.h

which will (after bootstrapping) make a Makefile that you can use to build foo out of foo.c and bar.c.

"bootstrapping" is the term we generally use for the aclocal && autoheader && autoconf && automake stuff - which you would normally put in a script file called "bootstrap".

If you need more info than this, just let me know.

rlc
0
 
publicvoidCommented:
Hello everyone,

I am just getting into programing for linux, coming from a Visual Studio / Windows world.  First off, I am using kdevelop.  I selected the wizard that gives you a hello world c++ command line program.  I have left it alone, and tried to build it.  No go.  I get this error:

/bin/sh /home/johng/helloworld/admin/missing --run automake --gnu helloworld/Makefile
aclocal.m4:3009: your implementation of AM_INIT_AUTOMAKE comes from an
aclocal.m4:3009: old Automake version. You should recreate aclocal.m4
aclocal.m4:3009: with aclocal and run automake again.

Also, anyone know of any good books or good sources of info for using the kdevelop enviroment?

Thank you,
John Gjonola
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now