#! /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 FML module file (always gzipped since version 4.9 of GCC)
cp fml.mod fml_save.mod
mv fml.mod fml.gz
OK=0
gunzip fml.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 fml > /dev/null

# Compress the new module file
gzip fml_new
mv -f fml_new.gz fml.mod

# Clean the directory
rm -f fml_save.mod fml

