Skip to content
Snippets Groups Projects
Commit dc6be2cb authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added config.txt file

This is a textual file that contains all the configuration info.

It should be easier to parse from scripts.
parent 2130f248
No related branches found
No related tags found
No related merge requests found
...@@ -3,3 +3,4 @@ ...@@ -3,3 +3,4 @@
/ConfigInstall.cpp /ConfigInstall.cpp
/install* /install*
/version.h /version.h
/config.txt
...@@ -16,11 +16,15 @@ endif ...@@ -16,11 +16,15 @@ endif
# default target # default target
all: all:
$(MAKE) PLUMED_FORCE=yes ConfigInstall.cpp Config.cpp version.h $(MAKE) PLUMED_FORCE=yes ConfigInstall.cpp Config.cpp version.h config.txt
$(MAKE) Config.o ConfigInstall.o compile_options.sh $(MAKE) Config.o ConfigInstall.o compile_options.sh
obj: all obj: all
config.txt: ../../Makefile.conf
@echo "Updating config.txt file"
@ ../maketools/update-config-txt.sh config.txt $(CPPFLAGS)
version.h: version.h:
@echo "Updating version.h" @echo "Updating version.h"
@ ../maketools/update-version.sh version.h @ ../maketools/update-version.sh version.h
...@@ -68,7 +72,7 @@ compile_options.sh: ...@@ -68,7 +72,7 @@ compile_options.sh:
.PHONY: clean .PHONY: clean
clean: clean:
rm -f Config.cpp compile_options.sh Makefile_conf version.h rm -f Config.cpp compile_options.sh Makefile_conf version.h config.txt
rm -fr deps rm -fr deps
rm -f Config.cpp ConfigInstall.cpp compile_options.sh install.conf rm -f Config.cpp ConfigInstall.cpp compile_options.sh install.conf
rm -f $(CLEANLIST) rm -f $(CLEANLIST)
......
...@@ -162,6 +162,8 @@ endif ...@@ -162,6 +162,8 @@ endif
cp ../colvar/Template.cpp "$(DESTDIR)$(libdir)/$(program_name)/src/colvar/" cp ../colvar/Template.cpp "$(DESTDIR)$(libdir)/$(program_name)/src/colvar/"
# copy compile_options.sh file (we leave it in src/colvar/ for backward compatibility) # copy compile_options.sh file (we leave it in src/colvar/ for backward compatibility)
cp ../config/compile_options.sh "$(DESTDIR)$(libdir)/$(program_name)/src/config/compile_options.sh" cp ../config/compile_options.sh "$(DESTDIR)$(libdir)/$(program_name)/src/config/compile_options.sh"
# copy config.txt file (we leave it in src/colvar/ for backward compatibility)
cp ../config/config.txt "$(DESTDIR)$(libdir)/$(program_name)/src/config/config.txt"
ifdef LD_RO ifdef LD_RO
cp install/kernel.o "$(DESTDIR)$(libdir)/$(program_name)/obj/kernel.o" cp install/kernel.o "$(DESTDIR)$(libdir)/$(program_name)/obj/kernel.o"
else else
......
#! /bin/bash
# first argument is name of txt file to be updated
file="$1"
# version strings:
version=$(
echo "version short $(
if test -f ../../VERSION ; then
grep -v "#" ../../VERSION | sed 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'
else
echo "Unknown"
fi
)"
echo "version long $(
if test -f ../../VERSION ; then
grep -v "#" ../../VERSION
else
echo "Unknown"
fi
)"
echo "version git $(
if test -d ../../.git && hash git 2> /dev/null ; then
# describe --tags gives a nice name
# in case it does not work, fallback to normal hash (12 char long)
git describe --long --tags --dirty --always || git rev-parse --short=12 HEAD
else
echo "Unknown"
fi
)"
)
# first get full list of possible defines from configure.ac and .h
list="$(
{
cat ../../configure.ac
grep -E "^#" ../*/*.h ../*/*.cpp
} |
grep -o "__PLUMED_HAS_[A-Z_]*" |
sed "s/__PLUMED_HAS_//" | sort | uniq | tr A-Z a-z)"
# now get list of -D__PLUMED_HAS flags in Makefile.conf
has="$(
for flag
do
case "$flag" in
(-D__PLUMED_HAS_*=0) ;;
(-D__PLUMED_HAS_*=*) echo ${flag#-D} | sed "s/=.*//" ;;
(-D__PLUMED_HAS_*) echo ${flag#-D} ;;
(*) ;;
esac
done | sed "s/__PLUMED_HAS_//" | sort | uniq | tr A-Z a-z
)"
# now get a list of other defines in Makefile.conf
def="$(
for flag
do
case "$flag" in
(-D__PLUMED_HAS_*) ;;
(-D*) echo "define ${flag#-D}" ;;
(*) ;;
esac
done | sort | uniq
)"
modules=$(
cd ../
for dir in *
do
if test -f $dir/module.type
then
mtype="$(cat "$dir/module.type")"
is=""
case "$mtype" in
(always) is=on ;;
(default-on)
if test -f $dir.off ; then
is=off
else
is=on
fi ;;
(default-off)
if test -f $dir.on ; then
is=on
else
is=off
fi ;;
esac
echo "module $dir $is ($mtype)"
fi
done
)
{
echo "# version strings"
echo "# syntax: version short/long/git number"
echo "$version"
echo
echo "# list of 'has' options"
echo "# syntax: has name on/of"
echo "# if option xx is on then plumed has beeen compiled with -D__PLUMED_HAS_XX"
{
for d in $has
do
echo "has $d on"
done
for u in $list
do
found=ko
for d in $has
do
if test "$d" = "$u" ; then
found=ok
fi
done
if test "$found" = ko ; then
echo "has $u off"
fi
done
} | sort
echo
echo "# other defines"
echo "# syntax: define name=value"
echo "$def"
echo
echo "# list of modules"
echo "# syntax: module name on/off (default-on/default-off/always)"
echo "$modules" | sort
}> $file~
cmp -s $file~ $file || cp $file~ $file
rm $file~
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment