I currently have 10 tests in my autotoolset project. Any time I make a change to one of my src/ files and recompile, each test is rebuilt and linked. This is starting to have a considerable impact on my development time.
What is the best way to conditionally build binary programs, tests or otherwise, with GNU autotoolset? For instance, if I’m working in test/check_curl_requestheaders.cc, and I make a change, I am only going to want to recompile the library and then that one test and none of the other binaries.
I saw some mention of using automake conditionals (like WANTS_XXX) but I am not 100% certain that is what I’m looking for nor am I sure how that would be configured by autoconf.
I am sort of hoping for something that will end up looking like this:
./configure
make test/check_curl_requestheaders
or
./configure --only-build=test/check_curl_requestheaders
make
Pointers?
EDIT I’m not doing a configure before every make. If I make changes to check_curl_requestheaders, only check_curl_requestheaders is rebuilt as one would expect. The problem is that if I’m working on the RequestHeaders part of the library, and make a change to say, src/curl/requestheaders.cc, all of the the tests and other binaries are rebuilt, not just the check_curl_requestheaders. That is taking far too long, and that is what I am trying to avoid. If I have a dozen binaries, is there a way to rebuild only one of them?
I’m not sure this is the best way to do this, but it turns out that the programs in my test folder did have their own unique make targets. However, there were some issues.
To solve this, I wrote a shell script that does the following:
The code is listed below:
This lets me do the following:
Hopefully there will eventually be someone who can show me a more elegant solution to this problem, preferably using autoconf and automake. I have a feeling that this is probably something that these tools do out of the box and I just haven’t discovered it yet.