[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automatic macro dependencies
From: |
Harvey Chapman |
Subject: |
Re: Automatic macro dependencies |
Date: |
Tue, 05 Aug 2008 16:49:47 -0400 |
User-agent: |
Thunderbird 2.0.0.16 (Macintosh/20080707) |
Sam Ravnborg wrote:
http://www.kernel.org :-)
In the kernel we use a lot of CONFIG_ named variables and
changing one of these cause the relevant files to be rebuilt.
The steps are basically:....
Ah, thanks to all that replied. This is what I was looking for. I know
that make doesn't do what I want. I was looking for a recipe or a
pointer to a possible solution. I figured someone must have done this
before. This sounds like what I'm looking for. All of my macros start
with DEBUG_. I'll take a look at how the kernel does it. If I get it
working, I'll post a complete example solution here as thanks and also
to solicit suggestions.
The end result will have to scan each source file and build a list of
DEBUG_ macros it uses. Then a master list will have to be compared to a
previous master list to see if the master list has changed. If it has,
we make a list of macros that have been added or removed and recompile
all source files with intersecting macro lists. The recompiling could
occur by making the changed list a dependency of source files that
intersect or perhaps touching the source file.
So:
Flags that might be used: DEBUG_A DEBUG_B DEBUG_C DEBUG_D
ROUND 1
-------
Master List: DEBUG_A DEBUG_B DEBUG_C
source1.c uses DEBUG_A and DEBUG_B
source2.c uses DEBUG_B and DEBUG_C
source3.c uses DEBUG_D
Compile...
ROUND 2
-------
Change master list to: DEBUG_A DEBUG_B DEBUG_D
We see that it doesn't match the old list (presumably saved in a file).
We make a changed list (one removed, one added): DEBUG_C DEBUG_D
Re-compile any file that uses a macro in the change list.
source2.c and source3.c are recompiled.
I have enough to get started, and I'll post back with the results.
Many thanks,
H.