o
    ¢Ùld¬  ã                   @  sÀ   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g dgdgdgdgd
gdgdœZg d	gdœZddgZG dd„ deƒZdS )é    )ÚannotationsN)ÚMachineInfoé   )ÚEnvironment)ÚCompilerÚ z-O0z-gz-O3z-Osz-Obranchless)ÚplainÚdebugZdebugoptimizedÚreleaseZminsizeZcustomz-O1z-O2)r   Ú0ÚgÚ1Ú2Ú3Ús)FTz^-ffreestanding$z^-r$c                   @  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 )>ÚCompCertCompilerZccompÚreturnÚNonec                 C  s>   | j  d¡ | j  d¡ g }g ||g  |g  |g  dœ| _d S )Nr   Zsx)r   r   r   r   Z
everything)Zcan_compile_suffixesÚaddZ	warn_args)ÚselfZdefault_warn_args© r   úƒhome/ych/rk3568/buildroot/output/rockchip_rk3568_recovery/host/lib/python3.10/site-packages/mesonbuild/compilers/mixins/compcert.pyÚ__init__D   s   üzCompCertCompiler.__init__úT.List[str]c                 C  ó   g S ©Nr   ©r   r   r   r   Úget_always_argsO   ó   z CompCertCompiler.get_always_argsc                 C  r   r   r   r   r   r   r   Úget_pic_argsR   s   zCompCertCompiler.get_pic_argsÚ	buildtypeÚstrc                 C  ó   t | S r   )Úccomp_buildtype_args)r   r    r   r   r   Úget_buildtype_argsV   ó   z#CompCertCompiler.get_buildtype_argsc                 C  s   dS )NZpchr   r   r   r   r   Úget_pch_suffixY   r   zCompCertCompiler.get_pch_suffixÚpch_dirÚheaderc                 C  r   r   r   )r   r'   r(   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,é   )Úccomp_args_to_wulÚreÚmatchÚappend)Úclsr*   r+   Zpatched_argsÚargZaddedZptrnr   r   r   Ú_unix_args_to_native_   s   €
€z%CompCertCompiler._unix_args_to_nativeÚenvú'Environment'c                 C  r   r   r   )r   r4   r   r   r   Úthread_flagsm   r   zCompCertCompiler.thread_flagsc                 C  ó   dgS )Nz-Er   r   r   r   r   Úget_preprocess_only_argsp   ó   z)CompCertCompiler.get_preprocess_only_argsc                 C  r7   )Nz-cr   r   r   r   r   Úget_compile_only_argss   r9   z&CompCertCompiler.get_compile_only_argsc                 C  r   r   r   r   r   r   r   Úget_coverage_argsv   r   z"CompCertCompiler.get_coverage_argsc                 C  r7   )Nz	-nostdincr   r   r   r   r   Úget_no_stdinc_argsy   r9   z#CompCertCompiler.get_no_stdinc_argsc                 C  r7   )Nz	-nostdlibr   r   r   r   r   Úget_no_stdlib_link_args|   r9   z(CompCertCompiler.get_no_stdlib_link_argsÚoptimization_levelc                 C  r"   r   )Úccomp_optimization_args)r   r>   r   r   r   Úget_optimization_args   r%   z&CompCertCompiler.get_optimization_argsÚis_debugÚboolc                 C  r"   r   )Úccomp_debug_args)r   rA   r   r   r   Úget_debug_args‚   r%   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   rE   rF   Ú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!   )r'   r!   r(   r!   r   r   )r*   r   r+   r   r   r   )r4   r5   r   r   )r>   r!   r   r   )rA   rB   r   r   )rE   r   rF   r!   r   r   )Ú__name__Ú
__module__Ú__qualname__Úidr   r   r   r$   r&   r)   Úclassmethodr3   r6   r8   r:   r;   r<   r=   r@   rD   rO   r   r   r   r   r   @   s&    













r   )Ú
__future__r   rI   r.   ÚtypingÚTÚTYPE_CHECKINGZ	envconfigr   Úenvironmentr   Zcompilers.compilersr   Úobjectr#   r?   rC   r-   r   r   r   r   r   Ú<module>   s@   ú
ùþþ