aboutsummaryrefslogtreecommitdiff
path: root/src/makesource.sh
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-09-19 13:13:59 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2005-09-19 13:13:59 +0000
commitabc25c283253082f33b9ad21f6aa966b3eb94192 (patch)
treeb362b7a0f4a219a3652042428d21a98b4780d318 /src/makesource.sh
parente50cf427fd6a5d782414cb93446d38c73dd97022 (diff)
automatic adding of new source-files to the main setup function
svn path=/trunk/externals/iem/iemmatrix/; revision=3593
Diffstat (limited to 'src/makesource.sh')
-rwxr-xr-xsrc/makesource.sh65
1 files changed, 65 insertions, 0 deletions
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<file>_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
+