#! /bin/sh
#
#  Modify a Fortran module in such a way that components of some public
#  derived types are made private. There is no other way to do it,
#  unless using submodules facility.
#
#  É. Canot -- IPR/CNRS -- 12 Jan 2024
#
#-----------------------------------------------------------------------

cd include

# Uncompress the FGL module file (always gzipped since version 4.9 of GCC)
cp fgl.mod fgl_save.mod
mv fgl.mod fgl.gz
OK=0
gunzip fgl.gz && OK=1

if [ $OK -eq 0 ]; then
  echo "$0: Too old, not gzipped Fortran module format"
  exit 1
fi

# Apply the modification of some pre-defined symbols
../bin/subs_in_mod fgl > /dev/null

# Compress the new module file
gzip fgl_new
mv -f fgl_new.gz fgl.mod

# Clean the directory
rm -f fgl_save.mod fgl

