Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions cmds/cmd_menuconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@ def is_pkg_special_config(config_str):
return True
return False

def get_target_file(filename):
try:
config = open(filename, "r")
except:
print('open config:%s failed' % filename)
return None

for line in config:
line = line.lstrip(' ').replace('\n', '').replace('\r', '')

if len(line) == 0: continue

if line[0] == '#':
continue
else:
setting = line.split('=')
if len(setting) >= 2:
if setting[0].startswith('CONFIG_TARGET_FILE'):
target_fn = re.findall(r"^.*?=(.*)$",line)[0]
if target_fn.startswith('"'):
target_fn = target_fn.replace('"', '')

if target_fn == '':
return None
else:
return target_fn

return 'rtconfig.h'

def mk_rtconfig(filename):
try:
Expand All @@ -49,6 +77,10 @@ def mk_rtconfig(filename):
print('open config:%s failed' % filename)
return

target_fn = get_target_file(filename)
if target_fn == None:
return

rtconfig = open('rtconfig.h', 'w')
rtconfig.write('#ifndef RT_CONFIG_H__\n')
rtconfig.write('#define RT_CONFIG_H__\n\n')
Expand Down