summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/octopus/package.py37
1 files changed, 27 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py
index 01167d8a21..cb7e63c956 100644
--- a/var/spack/repos/builtin/packages/octopus/package.py
+++ b/var/spack/repos/builtin/packages/octopus/package.py
@@ -219,16 +219,33 @@ class Octopus(AutotoolsPackage, CudaPackage):
# In case of GCC version 10, we will have errors because of
# argument mismatching. Need to provide a flag to turn this into a
# warning and build sucessfully
-
- fcflags = "FCFLAGS=-O2 -ffree-line-length-none"
- fflags = "FFLAGS=O2 -ffree-line-length-none"
- if spec.satisfies("%gcc@10:"):
- gcc10_extra = "-fallow-argument-mismatch -fallow-invalid-boz"
- args.append(fcflags + " " + gcc10_extra)
- args.append(fflags + " " + gcc10_extra)
- else:
- args.append(fcflags)
- args.append(fflags)
+ # We can disable variable tracking at assignments introduced in GCC10
+ # for debug variant to decrease compile time.
+
+ # Set optimization level for all flags
+ opt_level = "-O2"
+ fcflags = f"FCFLAGS={opt_level} -ffree-line-length-none"
+ cxxflags = f"CXXFLAGS={opt_level}"
+ cflags = f"CFLAGS={opt_level}"
+
+ # Add extra flags for gcc 10 or higher
+ gcc10_extra = (
+ "-fallow-argument-mismatch -fallow-invalid-boz"
+ if spec.satisfies("%gcc@10:")
+ else ""
+ )
+ # Add debug flag if needed
+ if spec.satisfies("+debug"):
+ fcflags += " -g"
+ cxxflags += " -g"
+ cflags += " -g"
+ gcc10_extra += (
+ "-fno-var-tracking-assignments" if spec.satisfies("%gcc@10:") else ""
+ )
+
+ args.append(f"{fcflags} {gcc10_extra}")
+ args.append(f"{cxxflags} {gcc10_extra}")
+ args.append(f"{cflags} {gcc10_extra}")
return args