Implement a config.h to move defines off the compile line and reduce builds

This commit is contained in:
Douglas Clowes
2013-08-01 13:02:13 +10:00
parent 69925baaf6
commit df7afb367a
3 changed files with 33 additions and 16 deletions

24
site_ansto/make_config.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
#
# Write a new config.h, but only if changed
#
rm -f config_new.h
SICS_SITE=$(bash extract_version.sh SITE)
SICS_VERSION=$(bash extract_version.sh VERSION)
SICS_REVISION=$(bash extract_version.sh REVISION)
echo "#define SICS_SITE \"$SICS_SITE\"" >> config_new.h
echo "#define SICS_VERSION \"$SICS_VERSION\"" >> config_new.h
echo "#define SICS_REVISION \"$SICS_REVISION\"" >> config_new.h
if [[ -f /usr/include/valgrind/memcheck.h ]]
then
echo "#define SICS_VALGRIND" >> config_new.h
fi
delta=$(diff -q config.h config_new.h 2>> /dev/null)
if [[ $? == 0 ]]
then
echo "config not changed"
rm -f config_new.h
else
echo "config updated"
mv -f --backup config_new.h config.h
fi