def parse_defines(args):
macros = {}<EOL>for arg in args:<EOL><INDENT>try:<EOL><INDENT>var, val = arg.split('<STR_LIT:=>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>var = arg<EOL>val = '<STR_LIT:1>'<EOL><DEDENT>macros[var] = val<EOL><DEDENT>return macros<EOL>
This parses a list of define argument in the form of -DNAME=VALUE or -DNAME (
which is treated as -DNAME=1).