[Scons-users] Storing object files in different directory

Gary Oberbrunner garyo at oberbrunner.com
Sat Oct 11 10:55:15 EDT 2014


As the user guide says in sec. 15
(http://www.scons.org/doc/HTML/scons-user/ch15.html) it is much easier
to use SConscript(..., variant_dir=...) than call VariantDir directly.
If you don't want to have a SConscript, but really want to use
VariantDir directly, the example at
http://www.scons.org/doc/HTML/scons-user/ch15s04.html shows some
helpful hints.

And the error message is correct; a build dir can't have two different
source dirs.  What if they had conflicting filenames?

On Sat, Oct 11, 2014 at 10:31 AM, Christopher Dimech
<dimech.christopher at gmail.com> wrote:
> 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
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>



-- 
Gary


More information about the Scons-users mailing list