[Scons-users] Storing object files in different directory

Gary Oberbrunner garyo at oberbrunner.com
Sat Oct 11 09:24:00 EDT 2014


It's best to put the SConstruct at top level, in your case under vik.
To run it from some other dir, just use scons with -D or -u or -U
depending on what you want built by default.

To use with a build dir, see VariantDir in the man page and user
guide.  That will create all the build products (obj files,
executables, modules) in the build tree.  You can then use Install to
copy the desired targets into an install tree or anywhere else.

On Sat, Oct 11, 2014 at 8:47 AM, 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
>
> _______________________________________________
> 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