@@ -36,6 +36,7 @@ def __init__(self, target, inputDir, program_name, build_url_resolver, extra_sym
3636 self .extra_symbols = extra_symbols
3737 self .config_macros = []
3838 self .sources_relative = sources_relative
39+ self .config_header = None
3940
4041 def get_toolchain (self ):
4142 return self .TOOLCHAIN
@@ -48,6 +49,9 @@ def flags(self):
4849 def progen_flags (self ):
4950 if not hasattr (self , "_progen_flag_cache" ) :
5051 self ._progen_flag_cache = dict ([(key + "_flags" , value ) for key ,value in self .flags .iteritems ()])
52+ if self .config_header :
53+ self ._progen_flag_cache ['c_flags' ] += self .toolchain .get_config_option (self .config_header )
54+ self ._progen_flag_cache ['cxx_flags' ] += self .toolchain .get_config_option (self .config_header )
5155 return self ._progen_flag_cache
5256
5357 def __scan_and_copy (self , src_path , trg_path ):
@@ -167,9 +171,15 @@ def scan_and_copy_resources(self, prj_paths, trg_path, relative=False):
167171 # Loads the resources into the config system which might expand/modify resources based on config data
168172 self .resources = config .load_resources (resources )
169173
170- # And add the configuration macros to the toolchain
171- self .config_macros = config .get_config_data_macros ()
172-
174+
175+ if hasattr (self , "MBED_CONFIG_HEADER_SUPPORTED" ) and self .MBED_CONFIG_HEADER_SUPPORTED :
176+ # Add the configuration file to the target directory
177+ self .config_header = self .toolchain .MBED_CONFIG_FILE_NAME
178+ config .get_config_data_header (join (trg_path , self .config_header ))
179+ self .config_macros = []
180+ else :
181+ # And add the configuration macros to the toolchain
182+ self .config_macros = config .get_config_data_macros ()
173183 # Check the existence of a binary build of the mbed library for the desired target
174184 # This prevents exporting the mbed libraries from source
175185 # if not self.toolchain.mbed_libs:
0 commit comments