Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: generate config.h and implicitly include it
All source files will now depend on config.h, which is generated based on the defaults in CONFIG and the command line arguments passed to make. This ensures that any configuration changes, including on the command line, cause a full rebuild. Change-Id: I6b6fa3290941200dbcf32297c66df8dc5ee18e94 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
- Loading branch information
1 parent
34731b0
commit 92a02f5
Showing
3 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
import re | ||
import sys | ||
|
||
comment = re.compile('^\s*#') | ||
assign = re.compile('^\s*([a-zA-Z_]+)\s*(\?)?=\s*([^#]*)') | ||
|
||
with open('CONFIG') as f: | ||
for line in f: | ||
line = line.strip() | ||
if not comment.match(line): | ||
m = assign.match(line) | ||
if m: | ||
var = m.group(1).strip() | ||
default = m.group(3).strip() | ||
val = default | ||
for arg in sys.argv: | ||
m = assign.match(arg) | ||
if m: | ||
argvar = m.group(1).strip() | ||
argval = m.group(3).strip() | ||
if argvar == var: | ||
val = argval | ||
if default.lower() == 'y' or default.lower() == 'n': | ||
if val.lower() == 'y': | ||
boolval = 1 | ||
else: | ||
boolval = 0 | ||
print "#define SPDK_{} {}".format(var, boolval) | ||
else: | ||
strval = val.replace('"', '\"') | ||
print "#define SPDK_{} \"{}\"".format(var, strval) |