1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-19 12:32:40 +01:00
qmckl/tools/tangle.sh

42 lines
1.0 KiB
Bash
Raw Normal View History

2021-03-09 01:16:23 +01:00
#!/bin/bash
# Script to tangle the org-mode files
# :PROPERTIES:
# :header-args: :tangle tangle.sh :noweb yes :shebang #!/bin/bash :comments org
# :END:
# This file was created by tools/Building.org
# This file needs to be run from the QMCKL =src= directory.
# It tangles all the files in the directory. It uses the
# =config_tangle.el= file, which contains information required to
# compute the current file names using for example ~(eval c)~ to get
# the name of the produced C file.
# The file is not tangled if the last modification date of the org
# file is less recent than one of the tangled files.
2021-03-19 13:47:50 +01:00
2021-03-09 01:16:23 +01:00
function tangle()
{
2021-03-19 13:47:50 +01:00
local org_file=$1
local c_file=${org_file%.org}.c
local f_file=${org_file%.org}.f90
if [[ ${org_file} -ot ${c_file} ]] ; then
return
elif [[ ${org_file} -ot ${f_file} ]] ; then
return
2021-03-09 01:16:23 +01:00
fi
2021-05-10 10:05:50 +02:00
emacs --batch ${org_file} --load=${top_srcdir}/tools/config_tangle.el -f org-babel-tangle
2021-03-09 01:16:23 +01:00
}
for i in $@
do
2021-03-19 13:47:50 +01:00
echo "--- ${i} ----"
tangle ${i}
2021-03-09 01:16:23 +01:00
done