[Scons-users] Storing object files in different directory

Christopher Dimech dimech.christopher at gmail.com
Sat Oct 11 10:31:43 EDT 2014


I changed scons to the following


env = Environment(
         ENV = {'PATH' : path},
         tools=['default','gfortran'],
         FORTRANFLAGS='-ffree-form -g',
         LINK='gfortran',
         LINKFLAGS='-g'
      )

sources = ['../../lib/endian.f', '../../utils/botoh.f', ]

VariantDir ('.','../../lib')
VariantDir ('.','../../utils')

allobjs = env.Object(sources)

# Get rid of the .mod names
objs = filter(lambda o: str(o)[-4:] != '.mod', allobjs)

env.Program('botoh.x', objs)


Then getting the error


scons -D -f botoh.sc
scons: Reading SConscript files ...

scons: *** '.' already has a source directory:
'/media/ios120/cdi/resip/vik/lib'.
File "/media/ios120/cdi/resip/vik/build/sc/botoh.sc", line 15, in <module>



On 11 October 2014 15:16, Christopher Dimech <dimech.christopher at gmail.com>
wrote:

> Have tried the following but getting the same problem
>
> scons -D -f botoh.sc
>
> I know about variantDir, however I am unsure how to use it
> for my case.
>
> VariantDir('build', 'src')
>
>
> I rather not use SConstruct at top level and have a build
> directory.
>
> On 11 October 2014 13:47, Christopher Dimech <dimech.christopher at gmail.com
> > wrote:
>
>> I have the following scons file
>>
>>
>> path = ['/bin', '/usr/bin', '/home/cdim/Local/gcc-4.9.0/bin']
>>
>> env = Environment(
>>          ENV = {'PATH' : path},
>>          tools=['default','gfortran'],
>>          FORTRANFLAGS='-ffree-form -g',
>>          LINK='gfortran',
>>          LINKFLAGS='-g'
>>       )
>>
>> sources = ['../../lib/endian.f', '../../utils/botoh.f', ]
>>
>> allobjs = env.Object(sources)
>>
>> # Get rid of the .mod names
>> objs = filter(lambda o: str(o)[-4:] != '.mod', allobjs)
>>
>> env.Program('botoh.x', objs)
>>
>>
>> The .o files are being created at the location of the .f files.
>>
>> ../../lib/endian.o   and   ../../utils/botoh.o
>>
>>
>> The .mod file for the fortran module ../../lib/endian.f
>> and the executable botoh.x are being created in the
>> directory where scons is being run
>>
>> This it the tree structure
>>
>> vik/build/sc/botoh.sc
>> vik/lib/endian.f
>> vik/utils/botoh.f
>>
>>
>> This is how I run scons
>>
>> cd vik/build/sc
>> scons -f botoh.sc
>>
>>
>> I want that the object files are put in   *vik/build*   as well
>>
>> vik/build/
>>
>>
>>
>> --
>> Christopher Dimech
>>
>
>
>
> --
> Christopher Dimech
>



-- 
Christopher Dimech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20141011/748d8369/attachment-0001.html>


More information about the Scons-users mailing list