o
    uJAf%                     @  s  U d dl mZ 	 d dlZd dlZddlmZmZ ejr*ddl	m
Z
 ddlmZmZ neZg g g g g g dZded	< i d
dd
gdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgdddgddgddgddgddgdd gdd!gdd"gdd#gdd$gdd%gdd&gdd'gd(Zded)< i d
dd
gd*dd*gd+dd+gd,dd,gd-dd-gd.dd.gd/dd/gd0dd0gd1dd1gd2dd2gd3dd3gd4dd4gd5dd5gd6dd6gd7dd7gd8dd8gd9dd9gdd:gdd;gdd<gdd=gdd>gdd?gdd@gddAgdBZdedC< ddDgddEgddFgddGgddHgddIgddJgddKgddLgddMgddNgddOgdPZdedQ< i d*dd*gd+dd+gd,dd,gd-dd-gd.dd.gdRddRgd/dd/gd0dd0gd1dd1gd2dd2gd3dd3gd4dd4gd5dd5gdSddSgd6dd6gdTddTgd7dd7gi d8dd8gd9dd9gd:dd:gdUddUgd;dd;gdVddVgdWddWgdXddXgdYddYgdZddZgd<dd<gd[dd[gd=dd=gd\dd\gd]dd]gd>dd>gd^dd^gi d?dd?gd_dd_gd`dd`gdaddagdbddbgdcddcgdddddgdeddegdfddfgd@dd@gdgddggdhddhgdiddigdjddjgdAddAgd
dd
gZdedk< g dlgdmgdngdogdpgdqgdrZdeds< g dtgduZdvedw< G dxdy dyeZdS )z    )annotationsN   )EnvironmentException	OptionKey)MachineInfo)CompilerCompileCheckMode)plaindebugdebugoptimizedreleaseminsizecustomzT.Dict[str, T.List[str]]mwcc_buildtype_argsZgenericz-procZv4Zv4tZv5tZv5teZv6Zarm7tdmiZarm710tZarm720tZarm740tZarm7ejZarm9tdmiZarm920tZarm922tZarm940tZarm9ejZarm926ejarm946earm966earm1020earm1022e	arm1026ejdbmx1dbmxlXScalepxa255pxa261pxa262pxa263)r   r   r   r   r   r   r   r   r   r   r   r   mwccarm_instruction_set_argsZ401Z403Z505Z509Z555Z601Z602Z603Z603eZ604Z604eZ740Z750Z801Z821Z8238508607400745082408260e500gekko)r   r   r   r    r!   r"   r#   r$   mwcceppc_instruction_set_argsarm4arm4tarm4xmarm4txmarm5arm5Tarm5xMarm5TxMarm5TEarm5TExParm6xscale)r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   mwasmarm_instruction_set_argsZ56XZ74XZ75XZ85XZ86XZ87XZ88XZ5100Z5200Z744XZ745XZ82XXZ824XZ827XZ8280Ze300Ze300c2Ze300c3Ze300c4Ze600Z85xxZe500v2ZZenZ5565Z5674mwasmeppc_instruction_set_argsz-O0z-Opz-O1z-O2z-O4,pz-Os)r	   0g123smwcc_optimization_argsz-g)FTzT.Dict[bool, T.List[str]]mwcc_debug_argsc                   @  s  e Zd ZdZdZdPddZdQd
dZdRddZdSddZdTddZ	dRddZ
dUddZdVddZdWd d!ZdXd$d%ZdRd&d'ZdRd(d)ZdRd*d+ZdYd-d.ZdZd0d1ZdRd2d3ZdRd4d5ZdRd6d7Zd[d:d;Zd\d=d>ZdWd?d@Zd]dBdCZdRdDdEZed^dIdJZd_dMdNZdOS )`MetrowerksCompilerZmwccFreturnNonec                 C  sZ   | j s
tt ddd dD | _g }ddg||ddg |ddg |dd	g d
| _d S )Nz! supports only cross-compilation.c                 S  s   h | ]}t |qS  )r   ).0or?   r?   K/usr/lib/python3.10/site-packages/mesonbuild/compilers/mixins/metrowerks.py	<setcomp>   s    z.MetrowerksCompiler.__init__.<locals>.<setcomp>)b_pchb_ndebug-woffZmostallfull)r4   r6   r7   r8   
everything)is_crossr   idbase_options	warn_args)selfdefault_warn_argsr?   r?   rB   __init__   s   


zMetrowerksCompiler.__init__objfilestrT.Optional[str]c                 C  s   t j|d d |   S )Nr   .)ospathsplitextget_depfile_suffix)rO   rR   r?   r?   rB   depfile_for_object   s   z%MetrowerksCompiler.depfile_for_objectT.List[str]c                 C     dgS )Nz-gccincr?   rO   r?   r?   rB   get_always_args      z"MetrowerksCompiler.get_always_args	buildtypec                 C     t | S N)r   )rO   r`   r?   r?   rB   get_buildtype_args      z%MetrowerksCompiler.get_buildtype_argsmoder   c                 C  s   g S rb   r?   )rO   re   r?   r?   rB   get_compiler_check_args      z*MetrowerksCompiler.get_compiler_check_argsc                 C  r\   )Nz-cr?   r]   r?   r?   rB   get_compile_only_args   r_   z(MetrowerksCompiler.get_compile_only_argsis_debugboolc                 C  ra   rb   )r;   )rO   ri   r?   r?   rB   get_debug_args   rd   z!MetrowerksCompiler.get_debug_args	outtargetoutfilec                 C     ddgS )Nz-gccdepz-MDr?   )rO   rl   rm   r?   r?   rB   get_dependency_gen_args   s   z*MetrowerksCompiler.get_dependency_gen_argsc                 C     dS )Ndr?   r]   r?   r?   rB   rY      rg   z%MetrowerksCompiler.get_depfile_suffixrW   	is_systemc                 C  s   |sd}d| gS )NrU   -Ir?   )rO   rW   rr   r?   r?   rB   get_include_args   s   
z#MetrowerksCompiler.get_include_argsc                 C  rn   )Nz-optrG   r?   r]   r?   r?   rB   get_no_optimization_args   rd   z+MetrowerksCompiler.get_no_optimization_argsc                 C  r\   )Nz	-nostdincr?   r]   r?   r?   rB   get_no_stdinc_args   r_   z%MetrowerksCompiler.get_no_stdinc_argsc                 C  r\   )Nz	-nostdlibr?   r]   r?   r?   rB   get_no_stdlib_link_args   r_   z*MetrowerksCompiler.get_no_stdlib_link_argsoptimization_levelc                 C  ra   rb   )r:   )rO   rx   r?   r?   rB   get_optimization_args   rd   z(MetrowerksCompiler.get_optimization_args
outputnamec                 C  s   d|gS )Nz-or?   )rO   rz   r?   r?   rB   get_output_args   rd   z"MetrowerksCompiler.get_output_argsc                 C  r\   )Nz-picr?   r]   r?   r?   rB   get_pic_args   r_   zMetrowerksCompiler.get_pic_argsc                 C  r\   )Nz-Er?   r]   r?   r?   rB   get_preprocess_only_args  r_   z+MetrowerksCompiler.get_preprocess_only_argsc                 C  r\   )Nz-Pr?   r]   r?   r?   rB   get_preprocess_to_file_args  r_   z.MetrowerksCompiler.get_preprocess_to_file_argspch_dirheaderc                 C  s   d|  |gS )Nz-prefix)get_pch_name)rO   r   r   r?   r?   rB   get_pch_use_args  s   z#MetrowerksCompiler.get_pch_use_argsnamec                 C  s   t j|d |   S )NrU   )rV   rW   basenameget_pch_suffix)rO   r   r?   r?   rB   r     s   zMetrowerksCompiler.get_pch_namec                 C  rp   )NZmchr?   r]   r?   r?   rB   r     rg   z!MetrowerksCompiler.get_pch_suffixlevelc                 C  s
   | j | S rb   )rN   )rO   r   r?   r?   rB   get_warn_args  s   
z MetrowerksCompiler.get_warn_argsc                 C  rn   )NrF   errorr?   r]   r?   r?   rB   get_werror_args  rd   z"MetrowerksCompiler.get_werror_argsargsinfor   c                 C  sr   g }|D ]2}| drd|dd   }| dr d|dd   }| dr&q|dkr+q| dr1q|| q|S )Nz-D   rs   z-Wl,-rpath=z--print-search-dirsz-L)
startswithappend)clsr   r   resultir?   r?   rB   _unix_args_to_native  s   



z'MetrowerksCompiler._unix_args_to_nativeparameter_list	build_dirc              
   C  sT   t |D ]#\}}|d d dkr'|d d tjtj||dd   ||< q|S )Nr   rs   	   )	enumeraterV   rW   normpathjoin)rO   r   r   idxr   r?   r?   rB   &compute_parameters_with_absolute_paths(  s
   .z9MetrowerksCompiler.compute_parameters_with_absolute_pathsN)r=   r>   )rR   rS   r=   rT   )r=   r[   )r`   rS   r=   r[   )re   r   r=   r[   )ri   rj   r=   r[   )rl   rS   rm   rS   r=   r[   )r=   rS   )rW   rS   rr   rj   r=   r[   )rx   rS   r=   r[   )rz   rS   r=   r[   )r   rS   r   rS   r=   r[   )r   rS   r=   rS   )r   rS   r=   r[   )r   r[   r   r   r=   r[   )r   r[   r   rS   r=   r[   )__name__
__module____qualname__rL   INVOKES_LINKERrQ   rZ   r^   rc   rf   rh   rk   ro   rY   rt   ru   rv   rw   ry   r{   r|   r}   r~   r   r   r   r   r   classmethodr   r   r?   r?   r?   rB   r<      s:    






















r<   )
__future__r   rV   typingTmesonlibr   r   TYPE_CHECKING	envconfigr   Zcompilers.compilersr   r   objectr   __annotations__r   r%   r2   r3   r:   r;   r<   r?   r?   r?   rB   <module>   s  		
 	
	
 !"#$%&'()*+,-./0126