[Scons-users] Removing object files

Christopher Dimech dimech.christopher at gmail.com
Sat Jul 11 18:40:58 EDT 2015


I have written the following scons file and want to have the ability
to delete the object files with a sort of clean option.


path = ['/bin', '/usr/bin']

env = Environment (
  ENV = {'PATH' : path},
  FORTRAN='/home/cdi/Local/gcc-5-20150201/bin/gfortran',
  FORTRANFLAGS='-ffree-form -g -pg -J./build/lib -fdiagnostics-color -Wall',
  LINK='/home/cdi/Local/gcc-5-20150201/bin/gfortran',
  LINKFLAGS='-g'
)

env.VariantDir (
  variant_dir = 'build/lib/behistun/larsa',
  src_dir = 'lib/behistun/larsa',
  duplicate = 0
)

env.VariantDir (
  variant_dir = 'build/lib/behistun/susa',
  src_dir = 'lib/behistun/susa',
  duplicate = 0
)

env.VariantDir (
  variant_dir = 'build/lib/behistun/meidum',
  src_dir = 'lib/behistun/meidum',
  duplicate = 0
)

env.VariantDir (
  variant_dir = 'build/sct/behistun/meidum',
  src_dir = 'sct/behistun/meidum',
  duplicate = 0
)

sources = [
  'build/lib/behistun/larsa/core_larsa.f',
  'build/lib/behistun/larsa/numset_larsa.f',
  'build/lib/behistun/larsa/strqry_larsa.f',
  'build/lib/behistun/susa/numtrf_susa.f',
  'build/lib/behistun/susa/numqry_susa.f',
  'build/lib/behistun/meidum/interval_meidum.f',
  'build/sct/behistun/meidum/sct_interval_meidum.f'
]

# Constructs object files without the .mod
allobjs = env.Object (sources)
objs = filter(lambda o: str(o)[-4:] != '.mod', allobjs)

env.Program (
  target = 'bin/sct/behistun/meidum/sct_interval_meidum.x',
  source = objs
)


More information about the Scons-users mailing list