#!/bin/sh # This script writes to stdout, a single source file (e.g. jimsh0.c) # which can be compiled to provide a bootstrap version of jimsh. # e.g. cc -o jimsh0 jimsh0.c makeext() { source="$1" basename=`basename "$source" .tcl` cat < #else #define TCL_PLATFORM_OS "unknown" #define TCL_PLATFORM_PLATFORM "unix" #define TCL_PLATFORM_PATH_SEPARATOR ":" #define HAVE_VFORK #define HAVE_WAITPID #endif EOF outputsource() { sed -e '/#include.*jim/d' -e '/#include.*utf8/d' \ -e '/^#.*if.*JIM_BOOTSTRAP/,/^#endif.*JIM_BOOTSTRAP/d' \ -e 's/\/\*.*\*\///' -e '/^[ ]*\/\*/,/\*\//d' $1 } # Now output header files, removing references to jim header files for i in utf8.h jim.h jim-subcmd.h jimregexp.h ; do outputsource $i done # Now extension source code for i in $tclexts; do makeext $i.tcl done for i in $cexts; do outputsource jim-$i.c done makeloadexts $allexts # And finally the core source code for i in jim.c jim-subcmd.c utf8.c jim-format.c jimregexp.c; do outputsource $i done echo "#ifndef JIM_BOOTSTRAP_LIB_ONLY" outputsource jim-interactive.c outputsource jimsh.c echo "#endif"