3333* Damian Alvarez (Forschungszentrum Juelich GmbH)
3434"""
3535from easybuild .tools import systemtools
36- from easybuild .tools .build_log import EasyBuildError
36+ from easybuild .tools .build_log import EasyBuildError , print_warning
3737from easybuild .tools .config import build_option
3838from easybuild .tools .toolchain .constants import COMPILER_VARIABLES
3939from easybuild .tools .toolchain .toolchain import Toolchain
@@ -244,6 +244,12 @@ def _set_compiler_vars(self):
244244
245245 def _set_compiler_flags (self ):
246246 """Collect the flags set, and add them as variables too"""
247+ variants = ['' , '_F' , '_F_UNIQUE' , '_C' , '_C_UNIQUE' , '_OPT' , '_PREC' ]
248+ for variant in variants :
249+ old_var = getattr (self , f'COMPILER{ variant } _FLAGS' , None )
250+ if old_var is not None :
251+ self .log .deprecated (f'COMPILER{ variant } _FLAGS has been renamed to COMPILER{ variant } _OPTIONS.' , '6.0' )
252+ setattr (self , f'COMPILER{ variant } _OPTIONS' , old_var )
247253
248254 flags = [self .options .option (x ) for x in self .COMPILER_OPTIONS if self .options .get (x , False )]
249255 cflags = [self .options .option (x ) for x in self .COMPILER_C_OPTIONS + self .COMPILER_C_UNIQUE_OPTIONS
@@ -261,6 +267,11 @@ def _set_compiler_flags(self):
261267 optflags = ([self .options .option (x ) for x in self .COMPILER_OPT_OPTIONS if self .options .get (x , False )] +
262268 [self .options .option (default_opt_level )])[:1 ]
263269
270+ # Normal compiler flags need to include "-" starting with EB 5.0, check the first as a sanity check.
271+ # Avoiding all flags as there may be legitimate use for flags that lack -
272+ if optflags and optflags [0 ] and not optflags [0 ][0 ].startswith ('-' ):
273+ print_warning (f'Compiler flag "{ optflags [0 ][0 ]} " does not start with a dash. See changes in EasyBuild 5.' )
274+
264275 # only apply if the vectorize toolchainopt is explicitly set
265276 # otherwise the individual compiler toolchain file should make sure that
266277 # vectorization is disabled for noopt and lowopt, and enabled otherwise.
0 commit comments