Nitay
Nitay

Reputation: 4690

Skipping configuration of projects that do not need compiling

I'm running a long build script compiling a lot of projects, and for most builds make usually returns with make: Nothing to be done for 'all', which is good because I'm not changing that much code on every build. The script still takes a long time to finish, however, simply because it calls autotools configurescript for each project, and some other scripts.

I've read somewhere that make uses timestamps to test if it needs to build.

Is there a way to ask Make if it needs to build or not before calling the configure script? Or maybe another way to prevent re-configuring of all projects?

Upvotes: 1

Views: 237

Answers (1)

John Bollinger
John Bollinger

Reputation: 180398

Having configured each project once, you do not need to run each configure script again unless those configure scripts themselves change, or you have reason to believe that the test results will have changed. If necessary, you can run config.status instead to recreate the output files without re-running all the tests. If you can be confident that the output files do not need to be recreated, either, then you can just run make.

Moreover, if you are using Automake in conjunction with Autoconf, then your Makefiles are built with tooling that detects when configure's m4 source, normally configure.ac, has changed, therefore requiring a reconfiguration. As long as the Makefile generated by Automake-based configure remains, you can just run make, and it will do the right thing. If the Makefile is missing, then you needed to run configure or config.status anyway.

Additionally, you could consider using a shared cache file for all your configure scripts, by specifying that file to each one via the --config-cache option. That should reduce the time each configure script consumes by avoiding redundant testing.

Upvotes: 4

Related Questions