genconfig: undef bool options so #ifdef works

Instead of always defining config values, only #define options that are
enabled, so that #ifdef/#ifndef can be used.  Generate #undef lines for
the disabled variables so the names are still visible in config.h.

Change-Id: Iaf56597ea6ae57b384387cc8a292d63960b611e4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-23 09:50:57 -07:00
parent 2a2615ec6e
commit 806eb493ca

View File

@ -24,10 +24,9 @@ with open('CONFIG') as f:
val = argval
if default.lower() == 'y' or default.lower() == 'n':
if val.lower() == 'y':
boolval = 1
print "#define SPDK_{} 1".format(var)
else:
boolval = 0
print "#define SPDK_{} {}".format(var, boolval)
print "#undef SPDK_{}".format(var)
else:
strval = val.replace('"', '\"')
print "#define SPDK_{} \"{}\"".format(var, strval)