views:

185

answers:

2

I build for more than two dozen targets from a source tree with usually three active branches with both production and debug builds. To date I've used a personal Makefile that defines the target which includes a common Makefile that defines the compile flags which then includes the Makefile from a specific source tree. This works but I can't help but thinking there's a better way.

I'd like to use a sqlite3 database to store and organize a full list of build flags. At compile time the database would be queried to generate to generate flags based on project version, platform and dev/production and start the build.

This database would be a single place where I can document and keep track my current settings for all my development builds. A base set of stored flags would be overridden by more granular flags at version, target platform, then build quality levels.

As part of implementing something like this I would also create a handful of shell scripts to manipulate the database and get/set flags as well as permit other developers in my lab adopt this more easily.

Has this already been done? Are there any examples of something like this?

Is there a different/better way to handle this?

Two things: * I cannot modify the original project Makefiles. * Attempting to use something like automake would be cumbersome as the necessary number of configure flags to enable a debugging level in an existing module of the code base would number in the hundreds.

+1  A: 

I suspect you may like to take a look at a more sophisticated build system. Take a look at ant, jam, and other build system tools. I think the standard GNU way of doing what you describe is through ./configure (autoconf) scripts, although I can see that managing the different configurations would be difficult.

Although writing your own Makefile configuration system is possible, I would suspect that if you want your code to have wider adoption, that using a more standard build system is the right answer.

slacy
This needs to be done apart from the original Makefile sources as the project contains hundreds of thousands of lines of code and the Makefiles have 13 years of tweaks that would never survive a conversion to something like autoconf.
Michael McCarty
Whoa... its slacy!
dicroce
I cannot rewrite the original Makefiles so ant, jam and autoconf isn't going to work in this instance
Michael McCarty
I don't understand -- you're saying that you've got an existing Makefile that you can't change, and then you're proposing storing all the Makefile config information in sqlite. I presumed that you would be doing something like "GCC=`select compiler from config;`" or somesuch...
slacy
A: 

IMHO, using a database for this is overkill. Using makefile includes is a clean and simple way to handle this. What are your concerns/issues/problems regarding this approach? Perhaps there's a way to restructure your makefiles to achieve your goals, without adding a database and without switching to a completely different build system.

jdigital