From abc25c283253082f33b9ad21f6aa966b3eb94192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Mon, 19 Sep 2005 13:13:59 +0000 Subject: automatic adding of new source-files to the main setup function svn path=/trunk/externals/iem/iemmatrix/; revision=3593 --- src/makesource.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 src/makesource.sh (limited to 'src/makesource.sh') diff --git a/src/makesource.sh b/src/makesource.sh new file mode 100755 index 0000000..8b634bb --- /dev/null +++ b/src/makesource.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +IEMMATRIX_H=iemmatrix_sources.h +IEMMATRIX_C=iemmatrix_sources.c + +EGREP=egrep +SED=sed +LS=ls + +################################# +## functions + +function head_h() { + echo "/* iemmatrix-setup autogenerated header-file" + echo " * generated by \"$0\"" + echo " * !! DO NOT MANUALLY EDIT !!" + echo " */" + echo + echo "#ifndef IEMMATRIX_SOURCES_H__" + echo "#define IEMMATRIX_SOURCES_H__" +} + +function foot_h() { + echo "#endif /* IEMMATRIX_SOURCES_H__ */" + echo "" +} + +function head_c() { + echo "/* iemmatrix-setup autogenerated setup-file" + echo " * generated by \"$0\"" + echo " * !! DO NOT MANUALLY EDIT !!" + echo " */" + echo + echo "#include \"$IEMMATRIX_H\"" + echo + echo "void iemmatrix_sources_setup(void)" + echo "{" +} + +function foot_c() { + echo "}" + echo +} + + +################################## +## body + +head_h > $IEMMATRIX_H +head_c > $IEMMATRIX_C + +for i in $(${LS} *.c | ${EGREP} -v "iemmatrix.*\.c") +do +## each c-file in iemmatrix needs to have an ie_setup()-function +## that calls all needed setup-functions +## any non-alpha-numeric-character is replaced by "_" +## e.g. "multiplex~.c" -> "z_multiplex__setup()" + SETUPNAME=ie$(echo ${i%.c} | ${SED} -e 's/[^[:alnum:]]/_/g')_setup + echo "void ${SETUPNAME}(void); /* $i */" >> $IEMMATRIX_H + echo " ${SETUPNAME}(); /* $i */" >> $IEMMATRIX_C +done + +foot_h >> $IEMMATRIX_H +foot_c >> $IEMMATRIX_C + -- cgit v1.2.1