#!/bin/sh
#
# Copyright (C) 2005-2009 ABINIT Group (Yann Pouillon)
# All rights reserved.
#
# This file is part of the ABINIT software package. For license information,
# please see the COPYING file in the top-level directory of the ABINIT source
# distribution.
#

# Stop at first error encountered
set -e

# Check that we are in the right directory
if test ! -s "./configure.ac" -o ! -s "src/main/abinit.F90"; then
 echo "makemake: This is not an ABINIT source tree - aborting now"
 exit 1
fi

# Import functions
. ./config/scripts/functions.sh

# Generate M4 includes
echon " * Generating aclocal.m4..."
aclocal -I config/m4
echo "done."

# Generate configure auxiliary files
echon " * Generating config.h.in..."
autoheader
echo "done."

# Generate configure
echon " * Generating configure script..."
autoconf
echo "done."

# Generate libtool scripts
#echo -n " * Generating libtool scripts..."
#libtoolize --automake --copy --force
#echo "done."

# Generate makefile inputs
# Do not use "automake --force-missing", as it overwrites the INSTALL file.
echo " * Generating Makefile.in for each directory:"
automake --add-missing --copy
echo " * All done."
