1 # $Id: make_cfg_header.awk 10546 2011-02-08 14:21:07Z dmytrof $
3 # Script to build C header file based
4 # on .config generated by xconfig/menuconfig tools
6 # Part of Metalink Wlan project build system
11 print "#ifndef __MTLK_DOT_CONFIG_H__";
12 print "#define __MTLK_DOT_CONFIG_H__";
16 # Empty lines to be preserved
17 /^$
/ { print ""; next; }
19 # True boolean variables
20 /CONFIG_
[A
-Z0
-9_
]+=y$
/ { sub(/^CONFIG_
/, "MTCFG_", $
1); print "#define " $
1 " (1)"; next; }
22 # False boolean variables
23 /^\
# CONFIG_[A-Z0-9_]+ is not set$/ { sub(/^CONFIG_/, "MTCFG_", $2); print "#undef " $2; next; }
26 /^CONFIG_
[A
-Z0
-9_
]+=
\".
*\"$
/ { sub(/^CONFIG_
/, "MTCFG_", $
1); print "#define " $
1 " " $
2; next; }
29 /^CONFIG_
[A
-Z0
-9_
]+=
[0-9]*$
/ { sub(/^CONFIG_
/, "MTCFG_", $
1); print "#define " $
1 " (" $
2 ")"; next; }
31 # General comments to be converted into C-style comments
33 if(!
match($
0, /.
*CONFIG_.
*/)) {
39 # Any other line should lead to error because we don't know how to process it
41 print "#error Unknown .config entry \"" $
0 "\" (line #" NR ")";
42 print "Failed to process line #" NR " of input data." > "/dev/stderr";
43 print "Contents of unrecognized entry \"" $
0 "\"." > "/dev/stderr";
44 print "The script cannot continue." > "/dev/stderr";
50 print "#endif /* __MTLK_DOT_CONFIG_H__ */"