10

Suppose I've ran ./configure and make, but now I want to change a parameter in the configure script. Do I need to run make clean before ./configure, or will everything be OK even if I don't?

sashoalm
  • 75,001
  • 122
  • 434
  • 781

2 Answers2

3

configure scripts are designed to run 'out-of-tree'. e.g., you can make a subdirectory build and run ../configure [options] from there, which will (ideally) only affect the build directory.

If you're using ./configure, you should run make clean prior to running configure again - just to be safe. Otherwise, if you're worried about side-effects, a properly written autotools suite should allow for an out-of-tree build directory.

Brett Hale
  • 21,653
  • 2
  • 61
  • 90
  • How would the out-of-tree build directory help if I don't delete it and just re-run `./configure`? What would be different? Otherwise it's an extra step, just the same as running `make clean`. – sashoalm May 19 '14 at 10:44
  • @sashoalm - running `make clean` or `make distclean` is somehow a time-consuming bottleneck in you development pipeline? The autotools are complex enough without trying to take 'clever' shortcuts, that might be anything but. – Brett Hale May 22 '14 at 04:31
3

In many cases things might be OK if you don't run make clean, but you can't assume they will.

An example of how things might go wrong: a configure flag might add a -D parameter to a CFLAGS variable or DEFS, instead of defining it through config.h. The latter would give your C files a dependency on config.h which in turn gets regenerated when you re-run configure. But in the former case, if you run configure again and change that flag, the set of #defined symbols in your C files will be different, but those C files will not be recompiled.

ptomato
  • 56,175
  • 13
  • 112
  • 165