1.1 --- a/lplc Wed Jun 16 00:53:24 2021 +0200
1.2 +++ b/lplc Tue Jun 22 22:49:47 2021 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Lichen Python-like compiler tool.
1.6
1.7 -Copyright (C) 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2016-2018, 2021 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -151,6 +151,7 @@
1.13 Some options may be followed by values, either immediately after the option
1.14 (without any space between) or in the arguments that follow them:
1.15
1.16 +-j Number of processes to be used when compiling
1.17 -o Indicate the output executable name
1.18 -W Show warnings on the topics indicated
1.19
1.20 @@ -190,8 +191,7 @@
1.21 elif "--version" in args or "-V" in args:
1.22 print >>sys.stderr, """\
1.23 lplc %s
1.24 -Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
1.25 - 2014, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.26 +Copyright (C) 2006-2018, 2021 Paul Boddie <paul@boddie.org.uk>
1.27 This program is free software; you may redistribute it under the terms of
1.28 the GNU General Public License version 3 or (at your option) a later version.
1.29 This program has absolutely no warranty.
1.30 @@ -206,6 +206,7 @@
1.31 gc_sections = False
1.32 ignore_env = False
1.33 make = True
1.34 + make_processes = []
1.35 make_verbose = True
1.36 outputs = []
1.37 paramnames = []
1.38 @@ -232,6 +233,7 @@
1.39 elif arg in ("-E", "--no-env"): ignore_env = True
1.40 elif arg in ("-g", "--debug"): debug = True
1.41 elif arg in ("-G", "--gc-sections"): gc_sections = True
1.42 + elif arg.startswith("-j"): l, needed = start_arg_list(make_processes, arg, 1)
1.43 # "P" handled below.
1.44 elif arg.startswith("--param-codes"): l, needed = start_arg_list(paramnames, arg, 1)
1.45 elif arg.startswith("--param-locations"): l, needed = start_arg_list(paramlocations, arg, 1)
1.46 @@ -353,7 +355,8 @@
1.47 # Compile the program unless otherwise indicated.
1.48
1.49 if make:
1.50 - make_clean_cmd = ["make", "-C", generated_dir, "clean"]
1.51 + processes = make_processes and ["-j"] + make_processes or []
1.52 + make_clean_cmd = ["make", "-C", generated_dir] + processes + ["clean"]
1.53 make_cmd = make_clean_cmd[:-1]
1.54
1.55 retval = call(make_cmd, make_verbose)