Modifying VTF Makefiles with autoconf and automake 
The VTF software uses autoconf and automake for compatible Makefile creation. Ensure that the right autoconf and automake versions are in the actual path. 
autoconf --version should give 2.59 or higher. 
automake --version should give 1.9 or higher. For convenience, the source code for these tools is also provided in 
vtf/third-party/autoconf.
The standard way of doing program development with autoconf and automake is to write a 
configure.ac file for your package and a 
Makefile.am file for each directory containing source files or further package subdirectories. Running the standard command 
autoreconf would go through the steps necessary to produce 
configure scripts and 
Makefile.in files as necessary. Then the top level 
configure script could be invoked as outlined on 
InstallationConfiguration. 
  make dependencies 
Since this procedure can be extremely inefficient during source code development, autoconf/automake is able to regenerate dependent files as needed during the make-process. This is achieved with dependency rules in 
Makefile. When the 
Makefile.am for a single application has been modified, for instance, only its 
Makefile.in and 
Makefile are regenerated automatically when the application is recompiled with 
make. Similar dependencies exist for 
config.status, 
configure, 
config.h.in, and 
aclocal.m4 that are automatically updated after changes to 
configure.ac when 
make is used anywhere in the corresponding build directory. 
The described 
make dependencies are 
disabled by default for the VTF by using the automake macro 
AM_MAINTAINER_MODE. This simplifies the usage of production systems since all generated autoconf/automake files can be checked into a CVS repository without problems. Using 
cvs update on checked out versions usually leads to timestamp mismatches in the autoconf/automake files and causes unwanted file regenerations. The problem is discussed at length in the 
CVS section of the automake manual.
To allow for convenient source code development, developers should therefore 
enable the autoconf/automake 
make dependencies (at least on their favorite development systems) by providing the option 
--enable-maintainer-mode to the top-level 
configure script or specifying 
MAINT=yes in 
vtf/setup. 
  Creating new build directories 
The standard way for the developer to create a new (application) build directory is to create new local 
Makefile.am files and to add those to the corresponding 
configure.ac. Running 
autoreconf on 
configure.ac or just 
make (for 
--enable-maintainer-mode) on the build directory with the corresponding 
config.status will automatically create all necessary files and new build sub-directories. 
-  Create the input file for automake Makefile.am. Copying and modifying an existing example is a good start. Gnu automake is quite convenient, but sometimes tricky. A close look on the manual typically answers most questions.
-  Add your new Makefile to the list AC_CONFIG_FILES([...])in the localconfigure.acfile, e.g.AC_CONFIG_FILES([weno/applications/euler/2d/Newdir/src/Makefile ...]). When you are using--enable-maintainer-mode, you just need to go tognu-debug-mpi/amroc/wenoand typemake.
-  When you are not using --enable-maintainer-mode, go into the directory with the modifiedconfigure.ac, i.e. tovtf/amroc/wenoin our example, and executeautoreconf. Ifconfigure.acwas supposed to remain unchanged, useautomake --foreign weno/applications/euler/2d/Newdir/src/Makefileto generate onlyvtf/amroc/weno/applications/euler/2d/Newdir/src/Makefile.in.
-  If vtf/amroc/weno/configuregot updated, all necessary further steps will once again be carried out automatically by autoconf, ifmakeis invoked in the build directory withconfig.status, which in our case isgnu-debug-mpi/amroc/weno.
-  If configurehad to remain untouched, one can produce only specified Makefiles. Go into thegnu-debug-mpi/amroc/wenodirectory and execute./config.status depfiles --files=amroc/weno/applications/euler/2d/Newdir/src/Makefile.
-  Finally go to gnu-debug-mpi/amroc/weno/applications/euler/2d/Newdir/srcand typemake.
  Useful scripts 
To simplify the program development with autoconf and automake the following scripts are provided in 
vtf/ac. To have them always 
available just append the directory 
vtf/ac to your 
PATH. Note that the usage of these scripts is completely optional. The previous paragraph contains ALL necessary native autoconf/automake commands to work with the VTF.
-  prepare [Optional list of Makefiles]
-  Creates configure,Makefile.inand further internal files as needed. To be run from directory that containsconfigure.ac.
-  Without any options the script rebuilds all Makefile.in's specified in configure.acand is identical to usingautoreconf.
 
-  prepare_all
-  Runs preparein all subdirectories with aconfigure.ac. To be run on top-levelvtfdirectory only by VTF admins. Idential to usingautoreconfon top-levelvtfdirectory.
 
-  create [Optional list of Makefiles]
-  Creates Makefile. To be run from a build directory that containsconfig.status. The script can traverse downwards to visit multipleconfig.statusfiles. By using./config.status depfiles --files=[list of Makefiles]internally it is able to produce new build sub-directories without including the Makefiles intoconfigure.ac. See below.
 
The scripts 
prepare and 
prepare_all are intended to produce Makefile.in from Makefile.am (to be written by the user) and to regenerate the script 
configure from 
configure.ac whenever necessary. If a 
configure script has been altered, the built-in dependencies in the files 
config.status in the build directory will 
automatically rerun 
config.status --recheck, which will regenerate 
all locally specified Makefiles. In order to regenerate only some Makefiles 
create is provided. Note that the usage of 
create also allows the creation of new subdirectories 
without touching 
configure or 
configure.ac.  
-  Create the input file for automake Makefile.amas sketched above.
-  Optionally modify configure.ac.
-  Go into the directory with the modified configure.ac, i.e. tovtf/amroc/wenoin our example, and executeprepare weno/applications/euler/2d/Newdir/src/Makefile. This will generate onlyvtf/amroc/weno/applications/euler/2d/Newdir/src/Makefile.inand updatevtf/amroc/weno/configureifvtf/amroc/weno/configure.acis newer.
-  If vtf/amroc/weno/configuregot updated, all necessary further steps will be carried out automatically by autoconf, ifmakeis invoked in the build directory withconfig.status, which in our case isgnu-debug-mpi/amroc/weno.
-  If the (sometimes too cumbersome) regeneration of all local Makefiles has to be avoided, configurehas to remain untouched andcreatecan be used to produce only specified Makefiles. Go into the current build directory, e.g.gnu-debug-mpiand executecreate amroc/weno/applications/euler/2d/Newdir/src/Makefile. Equivalently, you could also go down tognu-debug-mpi/amroc/wenoand executecreate applications/euler/2d/Newdir/src/Makefile.
-  Finally go to gnu-debug-mpi/amroc/weno/applications/euler/2d/Newdir/srcand typemake.
-- 
RalfDeiterding - 29 Dec 2016