3

I use waf (http://code.google.com/p/waf/) to build a fortran library (which also uses some c-code).

The corresponding wscript looks like this:

 def build(bld):

    bld(
            features = 'fc',
            source   = 'fortran_interface.f90',
            target   = 'fortran_interface.o')
            #install_path = '${PREFIX}/mod')
    #bld.install_files('${PREFIX}/mod','fortran_interface.mod')

    bld(
            features = 'c',
            includes = '../../include',
            source   = 'init_wrapper.c',
            target   = 'init_wrapper.o')

    bld(
            features = 'fc fcstlib',
            use      = 'init_wrapper.o fortran_interface.o',
            target   = 'fortran_interface',
            install_path = '${PREFIX}/lib')

The call waf produces looks like this:

fc: src/fortran/fortran_interface.f90 -> 
    build/src/fortran/fortran_interface.f90.1.o 
    build/fortran_interface.mod

I want to be able to install the .mod file to ${PREFIX}/mod. I tried install_path which has no effect in this case, or install_files which does not work because a) it doesn't look inside the build/ directory and b) because it complains before the building if a file is not present.3

imbaer
  • 554
  • 3
  • 21
  • I also use waf to build Fortran projects, however never tried to install module files anywhere, thus do not really have an idea what to do. I think the best thing to do, i think, is to ask your question on http://groups.google.com/group/waf-users Thomas Nagy is very responsive. – haraldkl Nov 25 '11 at 21:22
  • I've posted my question to said group. I will update this post aswell if I get any answers. – imbaer Nov 26 '11 at 11:26

1 Answers1

3

As to this thread (http://groups.google.com/group/waf-users/browse_thread/thread/c771a2f4fedd4e3?pli=1) the answer was to create

  • a separate build group

    bld.add_group()

  • and to use

    bld.srcnode.find_or_declare(<filename>.mod)

to make waf look in the build directory for the .mod file.

imbaer
  • 554
  • 3
  • 21