[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automatic macro dependencies
From: |
Sam Ravnborg |
Subject: |
Re: Automatic macro dependencies |
Date: |
Tue, 5 Aug 2008 22:42:05 +0200 |
User-agent: |
Mutt/1.4.2.1i |
On Tue, Aug 05, 2008 at 01:58:17PM -0400, Harvey Chapman wrote:
> Hello all,
>
> I'd like to be able to define a list of macros like (DEBUG_XX, DEBUG_YY)
> and have make detect that a source file needs to be recompiled because
> of a change in that list. These macros are always used with an "#ifdef"
> or an "#if defined()" style pre-processing directive.
>
> I would appreciate any pointers to solutions.
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:
1) Create a hirachy of files representing the possible CONFIG_
variables. For any CONFIG_ variable changed touch the file and
for new ones create the file and delete file for nonexisting ones.
2) When building a .c file parse the .c file (and included files)
and add a dependency to the file representing the CONFIG_ variable.
(See fixdep.c for the scanning)
3) Use the dependency file to update value of $? that is again
used to do an eventual rebuild fo a .c file.
See scripts/Kbuild.include and Makefile.build for details as well as
fixdep.c source.
But expect to use a few days before you get the details.
Sam