#!/bin/bash
# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

INTERNAL_HEADER=_hypre_utilities.h

#===========================================================================
# Include guards and other includes
#===========================================================================

cat > $INTERNAL_HEADER <<@

/*** DO NOT EDIT THIS FILE DIRECTLY (use 'headers' to generate) ***/

#ifndef hypre_UTILITIES_HEADER
#define hypre_UTILITIES_HEADER

#include "HYPRE_utilities.h"

#ifdef HYPRE_USING_OPENMP
#include <omp.h>
#endif

#ifdef HYPRE_MIXED_PRECISION
#include "_hypre_utilities_mup_def.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

@

#===========================================================================
# Structures and prototypes
#===========================================================================

cat magma.h                    >> $INTERNAL_HEADER
cat handle.h                   >> $INTERNAL_HEADER
cat state.h                    >> $INTERNAL_HEADER
cat general.h                  >> $INTERNAL_HEADER
cat base.h                     >> $INTERNAL_HEADER
cat matrix_stats.h             >> $INTERNAL_HEADER
cat printf.h                   >> $INTERNAL_HEADER
cat error.h                    >> $INTERNAL_HEADER
cat mpistubs.h                 >> $INTERNAL_HEADER
cat smp.h                      >> $INTERNAL_HEADER
cat memory.h                   >> $INTERNAL_HEADER
cat memory_tracker.h           >> $INTERNAL_HEADER
cat omp_device.h               >> $INTERNAL_HEADER
cat threading.h                >> $INTERNAL_HEADER
cat timing.h                   >> $INTERNAL_HEADER
cat amg_linklist.h             >> $INTERNAL_HEADER
cat exchange_data.h            >> $INTERNAL_HEADER
cat caliper_instrumentation.h  >> $INTERNAL_HEADER
cat gselim.h                   >> $INTERNAL_HEADER
cat int_array.h                >> $INTERNAL_HEADER
cat protos.h                   >> $INTERNAL_HEADER
cat hopscotch_hash.h           >> $INTERNAL_HEADER
cat mmio.h                     >> $INTERNAL_HEADER
cat _hypre_fortran_matrix.h    >> $INTERNAL_HEADER
cat multiprecision.h           >> $INTERNAL_HEADER

#===========================================================================
# Include guards
#===========================================================================

cat >> $INTERNAL_HEADER <<@

#ifdef __cplusplus
}
#endif

#ifdef HYPRE_MIXED_PRECISION
/* The following is for user compiles and the order is important.  The first
 * header ensures that we do not change prototype names in user files or in the
 * second header file.  The second header contains all the prototypes needed by
 * users for mixed precision. */
#ifndef hypre_MP_BUILD
#include "_hypre_utilities_mup_undef.h"
#include "_hypre_utilities_mup.h"
#endif
#endif

#endif

@


INTERNAL_HEADER=_hypre_utilities.hpp

#===========================================================================
# Include guards and other includes
#===========================================================================

cat > $INTERNAL_HEADER <<@

/*** DO NOT EDIT THIS FILE DIRECTLY (use 'headers' to generate) ***/

#ifndef hypre_UTILITIES_HPP
#define hypre_UTILITIES_HPP

#include <HYPRE_config.h>

#ifdef HYPRE_MIXED_PRECISION
#include "_hypre_utilities_mup_def.h"
#endif

#ifdef __cplusplus
extern "C++" {
#endif

@

#===========================================================================
# Structures and prototypes
#===========================================================================

cat functors.h             >> $INTERNAL_HEADER
cat predicates.h           >> $INTERNAL_HEADER
cat device_allocator.h     >> $INTERNAL_HEADER
cat device_utils.h         >> $INTERNAL_HEADER
cat device_reducer.h       >> $INTERNAL_HEADER

#===========================================================================
# Include guards
#===========================================================================

cat >> $INTERNAL_HEADER <<@

#ifdef __cplusplus
}
#endif

#ifdef HYPRE_MIXED_PRECISION
/* The following is for user compiles and the order is important.  The first
 * header ensures that we do not change prototype names in user files or in the
 * second header file.  The second header contains all the prototypes needed by
 * users for mixed precision. */
#ifndef hypre_MP_BUILD
#include "_hypre_utilities_mup_undef.h"
#include "_hypre_utilities_mup.h"
#endif
#endif

#endif

@
