#!/bin/sh
# This script creates a header file "adept_source.h" containing the
# ../adept/*.h ../adept/*.cpp source files; why this is useful is explained below.

ADEPT_SOURCE_HEADER=adept_source.h
rm -f $ADEPT_SOURCE_HEADER

echo "Creating $ADEPT_SOURCE_HEADER"

echo "/* $ADEPT_SOURCE_HEADER - Source code for the Adept library

  Copyright (C) 2012-2015 The University of Reading
  Copyright (C) 2015-2017 European Centre for Medium-Range Weather Forecasts

  Licensed under the Apache License, Version 2.0 (the \"License\"); you
  may not use this file except in compliance with the License.  You
  may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an \"AS IS\" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  implied.  See the License for the specific language governing
  permissions and limitations under the License.


  This file was created automatically by script $0 
  on "$(date)"

  It contains a concatenation of the source files from the Adept
  library. The idea is that a program may #include this file in one of
  its source files (typically the one containing the main function),
  and then the Adept library will be built into the executable without
  the need to link to an external library. All other source files
  should just #include <adept.h> or <adept_arrays.h>. The ability to
  use Adept in this way makes it easier to distribute an Adept package
  that is usable on non-Unix platforms that are unable to use the
  autoconf configure script to build external libraries.

  If HAVE_BLAS is defined below then matrix multiplication will be
  enabled; the BLAS library should be provided at the link stage
  although no header file is required.  If HAVE_LAPACK is defined
  below then linear algebra routines will be enabled (matrix inverse
  and solving linear systems of equations); again, the LAPACK library
  should be provided at the link stage although no header file is
  required.

*/

#warning \"The adept_source.h header file has not been edited so BLAS matrix multiplication and LAPACK linear-algebra support have been disabled\"

/* Uncomment this if you are linking to the BLAS library (header file
not required) to enable matrix multiplication */ //#define HAVE_BLAS 1

/* Uncomment this if you are linking to the LAPACK library (header file not required) */
//#define HAVE_LAPACK 1

/* Uncomment this if you have the cblas.h header from OpenBLAS */
//#define HAVE_OPENBLAS_CBLAS_HEADER

/*

  The individual source files now follow.

*/

#ifndef AdeptSource_H
#define AdeptSource_H 1

" > $ADEPT_SOURCE_HEADER

for FILE in ../config_platform_independent.h ../adept/*.h ../adept/*.cpp
do
    echo "   Adding $FILE"
    echo "

// =================================================================
// Contents of $(basename $FILE)
// =================================================================
" >> $ADEPT_SOURCE_HEADER
    cat $FILE >> $ADEPT_SOURCE_HEADER
done

echo "

#endif
" >> $ADEPT_SOURCE_HEADER
echo "Done"
