ó
óÏù]c           @   s‡   d  Z  d d l m Z m Z d d l m Z d „  Z d „  Z d „  Z e d „  ƒ Z	 e d „  ƒ Z
 e d	 „  ƒ Z e d
 „  ƒ Z d S(   s)   base for all c/c++ programs and librariesiÿÿÿÿ(   t   Utilst   Errors(   t   confc         C   s]   g  } xP t  j |  ƒ D]? } t | t ƒ s7 | j } n  | j | | j d ƒ d ƒ q W| S(   sØ   
	Returns the file extensions for the list of files given as input

	:param lst: files to process
	:list lst: list of string or :py:class:`waflib.Node.Node`
	:return: list of file extensions
	:rtype: list of string
	t   .i   (   R    t   to_listt
   isinstancet   strt   namet   appendt   rfind(   t   lstt   rett   x(    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyt   get_extensions
   s    	"c          K   su  t  |  d ƒ } |  d } g  } x1 d j ƒ  D]# } | | k r- | j d ƒ Pq- q- Wd | k sx d | k sx d | k rˆ | j d ƒ n  x1 d j ƒ  D]# } | | k r• | j d	 ƒ Pq• q• Wd
 | k rØ | j d
 ƒ n  d | k rõ | j d ƒ d S| d k rqt } x4 | D], } | d k r| j | | ƒ t } qqW| rq|  j d g  ƒ rqt j d |  ƒ ‚ qqn  | S(   s  
	Computes and returns the features required for a task generator by
	looking at the file extensions. This aimed for C/C++ mainly::

		snif_features(source=['foo.c', 'foo.cxx'], type='shlib')
		# returns  ['cxx', 'c', 'cxxshlib', 'cshlib']

	:param source: source files to process
	:type source: list of string or :py:class:`waflib.Node.Node`
	:param type: object type in *program*, *shlib* or *stlib*
	:type type: string
	:return: the list of features for a task generator processing the source files
	:rtype: list of string
	t   sourcet   typs   cxx cpp c++ cc Ct   cxxt   ct   valat   gss   f f90 F F90 for FORt   fct   dt   javat   programt   shlibt   stlibt   featuress;   Cannot link from %r, try passing eg: features="c cprogram"?(   R   R   R   (   R   R   R   R   (   R   t   splitR   t   Falset   Truet   getR   t   WafError(   t   kwt   extsR   t   featsR   t	   will_link(    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyt   sniff_features   s6    
$c         C   s@   | |  d <t  j |  j d g  ƒ ƒ t  j t |  �  ƒ |  d <d S(   sÏ   
	Inserts data in the input dict *kw* based on existing data and on the type of target
	required (typ).

	:param kw: task generator parameters
	:type kw: dict
	:param typ: type of target
	:type typ: string
	R   R   N(   R    R   R   R$   (   R    R   (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyt   set_featuresL   s    

c         O   s   t  | d ƒ |  | | Ž  S(   sÖ   
	Alias for creating programs by looking at the file extensions::

		def build(bld):
			bld.program(source='foo.c', target='app')
			# equivalent to:
			# bld(features='c cprogram', source='foo.c', target='app')

	R   (   R%   (   t   bldt   kR    (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyR   Y   s    c         O   s   t  | d ƒ |  | | Ž  S(   sÚ   
	Alias for creating shared libraries by looking at the file extensions::

		def build(bld):
			bld.shlib(source='foo.c', target='app')
			# equivalent to:
			# bld(features='c cshlib', source='foo.c', target='app')

	R   (   R%   (   R&   R'   R    (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyR   g   s    c         O   s   t  | d ƒ |  | | Ž  S(   sâ   
	Alias for creating static libraries by looking at the file extensions::

		def build(bld):
			bld.stlib(source='foo.cpp', target='app')
			# equivalent to:
			# bld(features='cxx cxxstlib', source='foo.cpp', target='app')

	R   (   R%   (   R&   R'   R    (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyR   u   s    c         O   s   t  | d ƒ |  | | Ž  S(   sÑ   
	Alias for creating object files by looking at the file extensions::

		def build(bld):
			bld.objects(source='foo.c', target='app')
			# equivalent to:
			# bld(features='c', source='foo.c', target='app')

	t   objects(   R%   (   R&   R'   R    (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyR(   ƒ   s    N(   t   __doc__t   waflibR    R   t   waflib.ConfigureR   R   R$   R%   R   R   R   R(   (    (    (    s,   /git_repos/ams-lv2/waflib/Tools/c_aliases.pyt   <module>   s   		2	