I'd like to generate a minimal source code of the Linux kernel that would pass make allnoconfig
. I managed to build a sample that only contains files used in the compilation process, but would now like to shrink that list. I know I can specify a custom preprocessor in the build process. The question is: how to preprocess C files so that all of the code would be copied verbatim, expect for #ifdefs which would be parsed and expanded - or skipped if the condition is not met?
Asked
Active
Viewed 37 times
0

d33tah
- 10,999
- 13
- 68
- 158
-
You can run the preprocessor by itself, but that will also expand macros. I don't think there's a way to make it only process `#ifdef` – Barmar Jul 25 '22 at 17:16
-
1Perhaps useful: [coan/unifdef](https://stackoverflow.com/q/45231857/1566221) – rici Jul 25 '22 at 17:22
-
1You can try the `unifdef` program. – Craig Estey Jul 25 '22 at 17:22