Commit a54d3949 authored by Vladislav Perepelkin's avatar Vladislav Perepelkin
Browse files

Merge branch 'compile_only_flag' into 'master'

Compile only flag

See merge request luna/lo3!28
parents e54ea404 e04d332e
......@@ -58,6 +58,10 @@ OPTIONS
-t
Show program execution time (compilation time is not included).
--compile-only
Do not run program after compilation. Also sets no-cleanup
flag. Output is a command for program execution.
ENVIRONMENT
Environment variables affect LuNA settings, but the OPTIONs take
......@@ -106,7 +110,7 @@ def parse_args(args):
'''
Parse and verify command-line arguments (see --help for info)
'''
global QUIET_FLAG, VERBOSE_FLAG
global QUIET_FLAG, VERBOSE_FLAG, COMPILE_ONLY_FLAG
conf={}
cur=0
......@@ -116,6 +120,8 @@ def parse_args(args):
conf['CLEANUP']=True
conf['TIME']=False
VERBOSE_FLAG=False
COMPILE_ONLY_FLAG=False
while cur<len(args):
arg=args[cur]
......@@ -135,6 +141,9 @@ def parse_args(args):
QUIET_FLAG=True
elif arg=='--verbose':
VERBOSE_FLAG=True
elif arg=='--compile-only':
COMPILE_ONLY_FLAG=True
conf['CLEANUP']=False
elif arg in ['-O', '-O0']:
if 'OPTIMIZATION' in conf and conf['OPTIMIZATION']!=arg:
raise FatalError("conflicting optimization options: " \
......@@ -268,7 +277,7 @@ def generate_cpp_blocks(ja_in_path, headers_in_path, ja_ti_path, b_in_path,
def info(msg):
if QUIET_FLAG:
if QUIET_FLAG or COMPILE_ONLY_FLAG:
return
if VERBOSE_FLAG:
if msg is None:
......@@ -650,8 +659,8 @@ def main():
else:
p=subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
out, err=p.communicate()
out=out.decode('utf-8')
err=err.decode('utf-8')
out=out.decode('utf-8') if out is not None else ''
err=err.decode('utf-8') if err is not None else ''
if p.returncode!=0:
err=translate_so_build_err(err)
......@@ -677,8 +686,10 @@ def main():
+ ':' + os.path.join(conf['LUNA_HOME'], 'lib')
if VERBOSE_FLAG:
if VERBOSE_FLAG or (COMPILE_ONLY_FLAG and not QUIET_FLAG):
print(' '.join(cmd))
if COMPILE_ONLY_FLAG:
exit(0)
t0=datetime.datetime.now()
p=subprocess.Popen(cmd, stderr=subprocess.PIPE, env=env)
......
......@@ -451,6 +451,10 @@ def get_target(obj):
path=None
if os.path.isabs(obj):
path=obj
try:
src=open(path).read()
except IOError as x:
return None
else:
for p in PATH:
# Read input
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment