#!/usr/bin/python # -*- coding: utf-8 -*- ##################################################################### # SConscript file - called by SConstruct file in the home of Cepam # # DESCRIPTION : # This file holds compilation instructions to build Cepam # # AUTHOR : # Mathieu Havel (mathieu.havel@oca.eu) # # CREATION DATE (dd/mm/yyyy) : # 23/01/2009 # # LAST CHANGE (dd/mm/yyyy) : # 23/01/2009 -- creation # # LICENCE : # GPL ##################################################################### ######################### #### Python module #### ######################### import os import fnmatch ############################ ### Environment import ### ############################ Import('*') # import all exported variables from main SConstruct file ################# ### Sources ### ################# modules = [] # finding modules (mod_*.f and mod_*.f90) src_dirs = [] # finding sub-directories (depth=1) in "src" directory (Coeur, Splines...) sources = [] # finding fortran files (*.f and *.f90) for filordir in os.listdir('.'): if (os.path.isdir(filordir) & (not filordir.startswith('.'))): src_dirs.append(src_dir+sep+filordir) for ffile in os.listdir(filordir): if ((fnmatch.fnmatch(ffile, "*.f")) | (fnmatch.fnmatch(ffile, "*.f90"))) : if ffile.startswith('mod_'): modules.append(filordir+sep+ffile) else: sources.append(filordir+sep+ffile) ################# ### Objects ### ################# ## Modules cepam_mod = env.Object(modules) mods = [] # removing *.mod from the list of objects for i in cepam_mod: if not str(i).endswith('.mod'): mods.append(src_dir+sep+str(i)) cepam_mod = mods ## Subroutines cepam_src = env.Object(sources) ## returning objects list objects = [cepam_mod, cepam_src] Return('objects')