<div dir="ltr">Austin<div><br></div><div>Here is the full makefile for a code we use. The variables defined externally in a separate config file are:</div><div>$(FF90)</div><div>$(FF90_FLAGS) </div><div>$(LIBDIR)</div><div>$(PETSC_LINKER_FLAGS)</div><div>$(LINKER_FLAGS)</div><div>$(CGNS_LINKER_FLAGS)</div><div><br></div><div>$(PYTHON) </div><div>$(PYTHON-CONIFG)</div><div>$(F2PY) </div><div>(These are usually use python, python-config and f2py. You can overwrite as necessary)</div><div><br></div><div>$(CC)</div><div>$(CC_ALL_FLAGS)</div><div><br></div><div>This essentially just mimics what f2py does automatically but we found it easier to control exactly what is going on. Essentially you are just compiling exactly as you normally an executable, but instead make a .so (with the -shared option) and including the additional .o files generated by compiling the f2py-generated wrappers.</div><div><br></div><div>Hope this helps,</div><div>Gaetan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 25, 2017 at 5:38 AM, Lisandro Dalcin <span dir="ltr"><<a href="mailto:dalcinl@gmail.com" target="_blank">dalcinl@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On 22 March 2017 at 20:29, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
  Lisandro,<br>
<br>
    We've had a couple questions similar to this with f2py; is there a way we could add to the PETSc/SLEPc makefile rules something to allow people to trivially use f2py without having to make their own (often incorrect) manual command lines?<br>
<br>
   Thanks<br>
<span class="m_5568433048286632261HOEnZb"><font color="#888888"><br></font></span></blockquote><div><br></div></span><div>Barry, it is quite hard and hacky to get f2py working in the general case. I think the email from Gaetan in this thread proves my point.</div><div><br></div><div>IMHO, it is easier to write a small Fortran source exposing the API to call using ISO_C_BINDINGS, then wrap that code with the more traditional C-based "static" tools (SWIG, Cython) or even "dynamically" with ctypes or cffi (which use dlopen'ing).</div><div><br></div><div><br></div></div><div><br></div>-- <br><div class="m_5568433048286632261gmail_signature" data-smartmail="gmail_signature">Lisandro Dalcin<br>============<br>Research Scientist<br>Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br><br>4700 King Abdullah University of Science and Technology<br>al-Khawarizmi Bldg (Bldg 1), Office # 0109<br>Thuwal 23955-6900, Kingdom of Saudi Arabia<br><a href="http://www.kaust.edu.sa" target="_blank">http://www.kaust.edu.sa</a><br><br>Office Phone: <a href="tel:+966%2012%20808%200459" value="+966128080459" target="_blank">+966 12 808-0459</a></div>
</div></div>
</blockquote></div><br></div>