2021-03-16 19:52:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-03-18 17:30:48 +01:00
|
|
|
if [[ $(basename $PWD) != "src" ]] ; then
|
|
|
|
echo "This script should run in the src directory"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We want the script to crash on the 1st error:
|
|
|
|
set -e
|
|
|
|
|
2021-03-17 14:33:32 +01:00
|
|
|
echo "create populated directories"
|
|
|
|
mkdir -p templates_front/populated
|
|
|
|
mkdir -p templates_text/populated
|
|
|
|
mkdir -p templates_hdf5/populated
|
|
|
|
|
2021-03-18 17:30:48 +01:00
|
|
|
# It is important to ad '--' to rm because it tells rm that what follows are
|
|
|
|
# not options. It is safer.
|
|
|
|
|
2021-03-17 14:33:32 +01:00
|
|
|
echo "remove existing templates"
|
2021-03-22 16:15:37 +01:00
|
|
|
rm -f -- templates_front/*.{c,h,f90}
|
2021-04-01 22:48:04 +02:00
|
|
|
rm -f -- templates_text/*.{c,h}
|
|
|
|
rm -f -- templates_hdf5/*.{c,h}
|
2021-03-17 14:33:32 +01:00
|
|
|
|
|
|
|
echo "clean populated directories"
|
2021-03-19 09:12:10 +01:00
|
|
|
rm -f -- templates_front/populated/*
|
2021-04-01 22:48:04 +02:00
|
|
|
rm -f -- templates_text/populated/*
|
|
|
|
rm -f -- templates_hdf5/populated/*
|
|
|
|
|
|
|
|
function tangle()
|
|
|
|
{
|
|
|
|
local command="(org-babel-tangle-file \"$1\")"
|
|
|
|
emacs --batch \
|
|
|
|
--eval "(require 'org)" \
|
|
|
|
--eval "(org-babel-do-load-languages 'org-babel-load-languages '((python . t)))" \
|
|
|
|
--eval "(setq org-confirm-babel-evaluate nil)" \
|
|
|
|
--eval "$command"
|
|
|
|
}
|
2021-03-16 19:52:33 +01:00
|
|
|
|
2021-03-17 14:33:32 +01:00
|
|
|
echo "tangle org files to generate templates"
|
|
|
|
cd templates_front
|
2021-04-01 22:48:04 +02:00
|
|
|
tangle templator_front.org
|
2021-03-17 14:33:32 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd templates_text
|
2021-04-01 22:48:04 +02:00
|
|
|
tangle templator_text.org
|
2021-03-17 14:33:32 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd templates_hdf5
|
2021-04-01 22:48:04 +02:00
|
|
|
tangle templator_hdf5.org
|
2021-03-17 14:33:32 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "run generator script to populate templates"
|
2021-03-18 17:30:48 +01:00
|
|
|
python3 generator.py
|
2021-03-16 19:52:33 +01:00
|
|
|
|
|
|
|
sleep 2
|
|
|
|
|
2021-03-17 14:33:32 +01:00
|
|
|
echo "compile populated files in the lib source files "
|
2021-03-16 19:52:33 +01:00
|
|
|
cd templates_front
|
|
|
|
source build.sh
|
|
|
|
cp trexio* ../
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd templates_text
|
|
|
|
source build.sh
|
|
|
|
cp trexio* ../
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd templates_hdf5
|
|
|
|
source build.sh
|
|
|
|
cp trexio* ../
|
|
|
|
cd ..
|
|
|
|
|