ó
LuNc        
   @   sþ  d  Z  d d l Z d d l Z d d l m Z d d l m Z m Z m Z m Z m	 Z	 e
 d k rúd Z e j Z e e e ƒ ƒ d k Z e j d ƒ e d	 e ƒ Z e d
 e ƒ Z e j d Z e d k rÖ d Z n  e j d j e ƒ d k Z e rBe j j e j d d ƒ e j j e j d d d ƒ e j j e j d d d ƒ e j j e j d d d ƒ e j j e j d d d ƒ g Z d d d d g Z g  Z x e D]… Z x| e j e d e ƒD]e \ Z Z Z  xS e  D]K Z! e! e k rØe j j" e! ƒ Z# e# d d k r#e j e# d ƒ q#qØqØWqÂWq¦We e e e ƒ )n  e e ƒ Z$ e$ d Z e$ d Z% e e ƒ d k rŠe d  GHe j& ƒ  n  e d! Z' e d Z e r"e d" k s¼e d# k r"e d e j( d ƒ d !Z e j d$ ƒ e e ƒ Z$ e$ d Z$ e e$ ƒ d k r"e% j e$ d ƒ q"n  e d% k rce j j) e ƒ sZe d& e GHe j& ƒ  n  d% Z* n¦ e j d' e j d( k ràe rÊe j j e j d) d* ƒ Z* e j j+ e* ƒ sºd% Z* n  e j d+ Z q	d% Z* e j d, Z n) e j j e j d- d* ƒ Z* e j d- Z e j j e d. e' d/ ƒ Z, e rse j j+ e, ƒ rNe j- e, ƒ n  e d0 e, d1 d1 j e% ƒ e ƒ n" e d2 e, d1 d1 j e% ƒ e ƒ x e% D] Z# e j- e# ƒ qœWe s e j d j d3 ƒ d k r e d4 e, d1 e j j e j d d5 d6 d d ƒ e. ƒ e j- e, ƒ q n  e e	 e, ƒ GHe* d% k ríe j/ d7 ƒ j0 ƒ  Z1 e1 j2 d8 ƒ d Z1 e1 d1 e j j2 e, ƒ d 7Z1 e r”e1 d9 7Z1 n e1 d1 j e e ƒ d ƒ 7Z1 e3 e* d: ƒ j0 ƒ  Z# e# e1 d8 7Z# e3 e* d; ƒ j4 e# ƒ n  e j& ƒ  n  d S(<   s÷  
#+
# NAME:
#	olb
# PURPOSE:
#	Recompile all F77 subroutines and functions, and create object library
#	libgen.a from the object files
# CALLING SEQUENCE:
#	olb
#	olb module	(where 'module' is an F77 module, e.g. forgen)
# INPUTS:
#	Fortran files selected from a number of subdirectories (see PROCEDURE).
# OPTIONAL INPUTS:
#	-g77		use g77 compiler
#	-intel		use Intel Fortran compiler
#	-pgi		use Portland compiler
#	-absoft or $ABSOFT set
#			use Absoft compiler
#	-dir=<dir>	destination directory for static library
#	If neither keyword or environment variable is set then g77 or Intel
#	compiler is used (whichever is found first using 'which')
# OUTPUTS:
#	New or updated object library libgen.a in $for (when executed on
#	the '$SMEI_ACCOUNT' software account) or $myfor (when executed on a
#	user account).
# CALLS:
#	mk, tiny.is_there, tiny.args, tine.run_cmd
# SIDE EFFECTS:
#	A compilation status line is added to $sys/olb.log
# RESTRICTIONS:
#	Can only be executed from the software account (i.e. $USER=$SMEI_ACCOUNT).
#	A line is added to $sys/olb.log with the time of compilation and
#	the module updated (if present)
# PROCEDURE:
# >	If no explicit module is specified then a hardcoded list of
#	Fortran files is used from $for and $SMEI_FOR, mostly from
#	subdirectories 'lib' and 'os' (containing OS-dependent files)
# >	If an explicit module with name 'module' is specified then the
#	file 'module.f' is processed after looking for it in directories
#	$myfor, $for and $SMEI_FOR, respectively.	
# >	Object files are created in $temp and deleted after use
# >	The library is created in $for (on the software account) or $myfor
#	(on a user account).
# >	The compilation command looks for include files in the directories
#	$for/h, $SMEI_FOR/h and $SMEI_FOR/h/linux.
# >	Two other switches are included:
#		-ffixed-line-length-none	-> extended fortran
#		-c				-> suppresses linking into executable
#
#	Some of the fortran files are compiled with the -w switch added to
#	suppress warning messages, mostly about unimplemented intrinsics such
#	as cosd, sind, etc.
#
#	An earlier version also used switches to be able to use our old
#	'signal' subroutine (signal is a unix function included in the
#	badu77 group and the unix group of intrinsics):
#		-fbadu77-intrinsic-hide
#		-funix-intrinsic-hide
#	Since 'signal' has been renamed 'say' we don't need these anymore.
#
# >	For gcc the machine type is determined with gcc -dumpmachine and
#	the version number with gcc -dumpversion.
#	For the Intel compilers -dumpmachine doesn't work, and -dumpversion
#	only works for version 8.0. ifc -dumpversion is used to determine
#	the version number. If it doesn't work version 6.0 is assumed (this
#	is the only version of ifc prior to 8.0 that we used).
# MODIFICATION HISTORY:
#	FEB-2001, Paul Hick (UCSD/CASS)
#	SEP-2002, Paul Hick (UCSD/CASS)
#		Removed -fdollar-ok option from g77 compilations (all dollar
#		signs in variable names should have been removed by now).
#	SEP-2004, Paul Hick (UCSD/CASS)
#		The name of the libgen library now tries to code
#		compiler information into the file name.
#		For g77 the name now is libgen_<machine>_gnu_<version>.a
#		For Intel ifc it is libgen_intel_<version>
#		On the software account the library is now created in
#		$SMEI_LIB instead of $for.
#	OCT-2004, Paul Hick (UCSD/CASS)
#		Added Portland compiler.
#	JAN-2004, Paul Hick (UCSD/CASS)
#		Converted from bash to Python.
#	SEP-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
#		Added get_compiler_intel.f and get_compiler_gnu.f
#		to list of files to be skipped.
#-
iÿÿÿÿN(   t   mk(   t   is_theret   startt   argst   run_cmdt   hide_envt   __main__s   olb, i   s   -objs   -verboses   -dir=t   HOSTNAMEs   cass185.ucsd.edus   ips.ucsd.edut   SMEI_MASTERt   SMEI_FORt   libt   ost   fnct   linuxt   SMEIt   fort   tdlibs	   forfits.fs	   arrinfo.fs   get_compiler_intel.fs   get_compiler_gnu.ft   topdowns   .fi    t   f77t   objs   no objects files createdi   t   g77t   gfortrant   goniodt    s   directory does not exist, t   USERt   SMEI_ACCOUNTt   SYSs   olb.logt   SMEI_LIBt   TUBt   FORt   libgens   .as	   ar -rcsv t    s   ar -rsv s	   .ucsd.edus   scp t   ucsdt   gens   date +"%Y-%m-%d %H:%M:%S"s   
s     allt   rt   w(5   t   __doc__t   sysR   R    t   tinyR   R   R   R   R   t   __name__t   sayt   argvt   lent   allt   appendt   verboset   lib_dirt   environt   hostnamet   findt	   is_mastert   patht   joint   all_fdirt
   skip_filesR   t   fdirt   walkt   Falset   roott   dirst   filest   onet   splitextt   tmpt   resultsR   t   exitt   f77idt   indext   isdirt   log_filet   isfileR   t   removet   Truet   popent   readt
   log_stringt   splitt   opent   write(    (    (    s   ./olb.pyt   <module>X   s¨   (		"%#


	


		%"8