diff --git a/arch/configure_reader.py b/arch/configure_reader.py index 2668a86f1f..98f758e0b8 100755 --- a/arch/configure_reader.py +++ b/arch/configure_reader.py @@ -17,7 +17,8 @@ osAndArchAlt = re.compile( r"^ARCH[ ]+(\w+)[ ]+(\w+)", re.I ) referenceVar = re.compile( r"[$]([(])?(\w+)(?(1)[)])", re.I ) -compileObject = re.compile( r"(\W)-c(\W)" ) +compileObject = re.compile( r"(\W|^)-c(\W|$)" ) +configureRepl = re.compile( r"(\W|^)CONFIGURE_\w+(\W|$)" ) class Stanza(): @@ -160,52 +161,9 @@ def sanitize( self ) : self.dereference( "FCBASEOPTS" ) # Remove rogue compile commands that should *NOT* even be here - keysToSanitize = [ - "ARFLAGS","ARFLAGS", - "CC", - "CFLAGS_LOCAL", - "CFLAGS", - "COMPRESSION_INC", - "COMPRESSION_LIBS", - "CPP", - "CPPFLAGS", - "DM_CC", - "DM_FC", - "ESMF_LDFLAG", - "F77FLAGS", - "FC", - "FCBASEOPTS_NO_G", - "FCBASEOPTS", - "FCOPTIM", - "FCSUFFIX", - "FDEFS", - "FFLAGS", - "FNGFLAGS", - "FORMAT_FIXED", - "FORMAT_FREE", - "LD", - "LDFLAGS_LOCAL", - "LDFLAGS", - "MODULE_SRCH_FLAG", - "RLFLAGS", - "SCC", - "SFC", - "TRADFLAG", - ] - - for keyToSan in keysToSanitize : - if keyToSan in self.kvPairs_ : - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_L", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMP_I", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FC", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CC", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_FDEFS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_MPI", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_COMPAT_FLAGS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_CPPFLAGS", "" ) - self.kvPairs_[ keyToSan ] = self.kvPairs_[ keyToSan ].replace( "CONFIGURE_TRADFLAG", "" ) - - self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + for keyToSan in self.kvPairs_.keys() : + self.kvPairs_[ keyToSan ] = configureRepl.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() + self.kvPairs_[ keyToSan ] = compileObject.sub( r"\1\2", self.kvPairs_[ keyToSan ] ).strip() # Now fix certain ones that are mixing programs with flags all mashed into one option