[gmx-developers] Modification of g_mdmat tool and compiling

Erik Lindahl lindahl at cbr.su.se
Fri Jan 16 14:07:28 CET 2009


Hi,

On Jan 16, 2009, at 1:03 PM, Mark Abraham wrote:

> Joshua Adelman wrote:
>> I'm attempting to write a modified version of g_mdmat to do some  
>> custom analysis of a simulation trajectory. Since what I'm trying  
>> to do requires only slight modification of the code, I thought the  
>> easiest thing to do is just copy g_mdmat.c and gmx_mdmat.c to  
>> something like g_mdmat2.c and gmx_mdmat2.c and compile them in the  
>> src/tools directory (as opposed to writing something from scratch  
>> given the template in shared/template). I'm just having a little  
>> bit of difficulty getting the modified versions compiled and was  
>> hoping someone could point me in the right direction. Since the  
>> Makefile and Makefile.in are auto-generated, I believe I shouldn't  
>> be modifying them directly. I tried inserting duplicating the  
>> enteries in Makefile.am that reference the g_mdmat files, and then  
>> rerun ./configure, but I'm not getting any instructions for the  
>> 'g_mdmat2' tool in Makefile and Makefile.in.
>
> A more elegant solution than the one DvdS suggested, is to adapt  
> Makefile.am suitably (wherever g_mdmat(.*) appears, modify suitably  
> to add your version), return to the top-level GROMACS directory and  
> invoke automake to create the Makefile.in files. Then invoke  
> configure to create the Makefile files. Then things should work OK,  
> and the GROMACS build process will build and install your utility.
>
> You may run into versioning issues with the autotools. Invoking  
> autom4te or autoconf in the top-level GROMACS directory may help  
> resolve these. Test on a non-precious GROMACS build directory first!
>
> If you're working in the CVS version, there's a "bootstrap" script  
> that takes care of the invocation order for you. Grabbing a copy of  
> it to apply to your modified 4.0.2 distribution may streamline  
> things for you.

In principle the autotools should actually detect and rebuild the  
files automatically for you when necessary, so ideally a "make" is  
enough even after modifying Makefile.am.

One problem with this is that the build tools might end up re-running  
the configure and automake commands separately for every single  
subdirectory in your tree, and then it's much cheaper to do as Mark  
says - go to the top directory and issue the commands there manually.

I've modified and included some libtool scripts in the release-4-0- 
patches CVS branch to reduce the autotools versioning issues for  
developers - in particular it should no longer matter whether you have  
libtool-1.x or 2.x installed. This will be included in 4.0.3 that we  
in best case might get out today or tomorrow!

Cheers,

Erik








More information about the gromacs.org_gmx-developers mailing list