| 1 | #/bin/bash |
| 2 | #TODO: dispatch in several files and run in parallel ?! |
| 3 | |
| 4 | #initialize main.c |
| 5 | printf '#include <stdlib.h>\n' > main.c |
| 6 | printf '\n' >> main.c |
| 7 | printf 'int main(int argc, char** argv)\n' >> main.c |
| 8 | printf '{\n' >> main.c |
| 9 | |
| 10 | #add functions |
| 11 | for file in `find . -type f -name \*.c ! -name main.c`; do |
| 12 | printf "\t//file $file :\n" >> main.c |
| 13 | functions=`grep '^ *void t_' $file | sed 's/^ *\(void [^(]*\).*/\t\1();/g'` |
| 14 | printf "$functions" >> main.c |
| 15 | printf '\n\n' >> main.c |
| 16 | done |
| 17 | |
| 18 | #finalize main.c |
| 19 | printf '\treturn 0;\n' >> main.c |
| 20 | printf '}\n' >> main.c |