o
    uJAfJ  ã                   @  sâ   U d dl mZ 	 d dlZd dlZd dlZejr*d dlmZ ddl	m
Z
 ddlmZ neZdgdd	gdd	gd
gdgdgdœZded< g dgdgdgdgd
gdgdœZded< g d	gdœZded< ddgZded< G dd„ deƒZdS )é    )ÚannotationsN)ÚMachineInfoé   )ÚEnvironment)ÚCompilerÚ z-O0z-gz-O3z-Osz-Obranchless)ÚplainÚdebugÚdebugoptimizedÚreleaseÚminsizeÚcustomzT.Dict[str, T.List[str]]Úccomp_buildtype_argsz-O1z-O2)r   Ú0ÚgÚ1Ú2Ú3ÚsÚccomp_optimization_args)FTzT.Dict[bool, T.List[str]]Úccomp_debug_argsz^-ffreestanding$z^-r$úT.List[str]Úccomp_args_to_wulc                   @  s´   e Zd ZdZd4dd„Zd5dd„Zd5d	d
„Zd6dd„Zd7dd„Zd8dd„Z	e
d9dd„ƒZd:dd„Zd5dd„Zd5d d!„Zd5d"d#„Zd5d$d%„Zd5d&d'„Zd;d)d*„Zd<d-d.„Zd=d1d2„Zd3S )>ÚCompCertCompilerÚccompÚreturnÚNonec                 C  s>   | j  d¡ | j  d¡ g }g ||g  |g  |g  dœ| _d S )Nr   Úsx)r   r   r   r   Ú
everything)Úcan_compile_suffixesÚaddÚ	warn_args)ÚselfÚdefault_warn_args© r$   úI/usr/lib/python3.10/site-packages/mesonbuild/compilers/mixins/compcert.pyÚ__init__D   s   ûzCompCertCompiler.__init__r   c                 C  ó   g S ©Nr$   ©r"   r$   r$   r%   Úget_always_argsP   ó   z CompCertCompiler.get_always_argsc                 C  r'   r(   r$   r)   r$   r$   r%   Úget_pic_argsS   s   zCompCertCompiler.get_pic_argsÚ	buildtypeÚstrc                 C  ó   t | S r(   )r   )r"   r-   r$   r$   r%   Úget_buildtype_argsW   ó   z#CompCertCompiler.get_buildtype_argsc                 C  s   dS )NÚpchr$   r)   r$   r$   r%   Úget_pch_suffixZ   r+   zCompCertCompiler.get_pch_suffixÚpch_dirÚheaderc                 C  r'   r(   r$   )r"   r4   r5   r$   r$   r%   Úget_pch_use_args]   r+   z!CompCertCompiler.get_pch_use_argsÚargsÚinfor   c                 C  sL   g }|D ]}d}t D ]}t ||¡r| d| ¡ d}q
|s#| |¡ q|S )z7Always returns a copy that can be independently mutatedr   z-WUl,é   )r   ÚreÚmatchÚappend)Úclsr7   r8   Zpatched_argsÚargÚaddedZptrnr$   r$   r%   Ú_unix_args_to_native`   s   €
€z%CompCertCompiler._unix_args_to_nativeÚenvú'Environment'c                 C  r'   r(   r$   )r"   rA   r$   r$   r%   Úthread_flagsn   r+   zCompCertCompiler.thread_flagsc                 C  ó   dgS )Nz-Er$   r)   r$   r$   r%   Úget_preprocess_only_argsq   ó   z)CompCertCompiler.get_preprocess_only_argsc                 C  rD   )Nz-cr$   r)   r$   r$   r%   Úget_compile_only_argst   rF   z&CompCertCompiler.get_compile_only_argsc                 C  r'   r(   r$   r)   r$   r$   r%   Úget_coverage_argsw   r+   z"CompCertCompiler.get_coverage_argsc                 C  rD   )Nz	-nostdincr$   r)   r$   r$   r%   Úget_no_stdinc_argsz   rF   z#CompCertCompiler.get_no_stdinc_argsc                 C  rD   )Nz	-nostdlibr$   r)   r$   r$   r%   Úget_no_stdlib_link_args}   rF   z(CompCertCompiler.get_no_stdlib_link_argsÚoptimization_levelc                 C  r/   r(   )r   )r"   rK   r$   r$   r%   Úget_optimization_args€   r1   z&CompCertCompiler.get_optimization_argsÚis_debugÚboolc                 C  r/   r(   )r   )r"   rM   r$   r$   r%   Úget_debug_argsƒ   r1   zCompCertCompiler.get_debug_argsÚparameter_listÚ	build_dirc              
   C  sT   t |ƒD ]#\}}|d d… dkr'|d d… tj tj ||dd … ¡¡ ||< q|S )Né	   z-I)Ú	enumerateÚosÚpathÚnormpathÚjoin)r"   rP   rQ   ÚidxÚir$   r$   r%   Ú&compute_parameters_with_absolute_paths†   s
   .€z7CompCertCompiler.compute_parameters_with_absolute_pathsN)r   r   )r   r   )r-   r.   r   r   )r   r.   )r4   r.   r5   r.   r   r   )r7   r   r8   r   r   r   )rA   rB   r   r   )rK   r.   r   r   )rM   rN   r   r   )rP   r   rQ   r.   r   r   )Ú__name__Ú
__module__Ú__qualname__Úidr&   r*   r,   r0   r3   r6   Úclassmethodr@   rC   rE   rG   rH   rI   rJ   rL   rO   rZ   r$   r$   r$   r%   r   @   s&    













r   )Ú
__future__r   rT   r:   ÚtypingÚTÚTYPE_CHECKINGÚ	envconfigr   Úenvironmentr   Zcompilers.compilersr   Úobjectr   Ú__annotations__r   r   r   r   r$   r$   r$   r%   Ú<module>   s@   ú
ùþþ