[cmake-developers] Integrate fixdep for kconfig

Sam H. samho5888 at gmail.com
Thu Oct 2 08:52:08 EDT 2014


Hi Brad,

I try my best to describe my understanding.

kconfig (
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/kbuild
) is a language for configuration.
After user finish configuration, it will generate files, e.g. autoconf.h
for C language and auto.conf for makefile,
and it will parse configuration to generate proper pseudo file for
dependency.
For example, CONFIG_A_B_C will be expanded as include/config/a/b/c.h,
CONFIG_TST1 will be expanded as include/config/tst1.h
So that files use CONFIG_A_B_C will have a dependency to
include/config/a/b/c.h.

C codes will check CONFIG_A_B_C that will be defined in autoconf.h
Since autoconf.h will be re-generated every time when configuration is
changed.
Files depend to autoconf.h will all be built even CONFIG it used is not
modified.
So autoconf.h need to be removed from dependency file and pseudo config
file refereed need to be added in.

Linux kernel build codes with -Wp,-MD,src/path/.file.o.d
It will generate dependency list that .h used.
Then fixdep will re-parse .file.o.d. It will
1. Remove common file like autoconf.h
2. Add dependency of CONFIG pseudo file.
The comments show more information about what fixdep do:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/scripts/basic/fixdep.c

My prototype patch is try to do what fixdep do in CMake.

Attached file is my test sample. (tested on Ubuntu 12.04 with CMake 3.0.1
patched)
After extract file.
1. Do configuration by: $ make allyesconfig
2. Generate CONFIG pseudo files: $ make silentoldconfig
3. Do CMake
    $ mkdir build
    $ cmake ..
    $ make
4. Do more configuration:
    $ cd ..
    $ make menuconfig
    $ make silentoldconfig
5. Test CMake again:
    $ cd build
    $ make

Because the license issue and mmap() issue, codes need to be re-implement.
However, I'm not familiar with CMake codes and C++.
So what can I do if this feature could be accepted?

Thanks,
Sam


2014-09-30 23:27 GMT+08:00 Brad King <brad.king at kitware.com>:

> On 09/24/2014 07:18 AM, Sam H. wrote:
> > I would like to use kconfig from Linux for my project settings.
> > So I integrate fixdep tools into CMake for parsing CONFIG_xxx key words
> > and set proper dependency of files that are generated by kconfig.
>
> For those of us unfamiliar with kconfig/fixdep, please provide a
> high level explanation of how they work and why CMake dependency
> scanning needs to be modified.
>
> > However, here come some issues.
> > 1. The codes from fixdep is declared as GPL. But CMake use BSD.
> > 2. fixed use mmap(). But this API is not support well on Windows.
>
> Both of these need to be addressed before a patch would be accepted.
> We cannot link GPLed code, and we need a portable implementation.
>
> Thanks,
> -Brad
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141002/15ce321a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_kconfig.tar.bz2
Type: application/x-bzip2
Size: 153547 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141002/15ce321a/attachment-0001.bin>


More information about the cmake-developers mailing list