about summary refs log tree commit diff
path: root/Src/mkbltnmlst.sh
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:38 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:05:38 +0000
commite74702b467171dbdafb56dfe354794a212e020d9 (patch)
treec295b3e9b2e93e2de10331877442615b0f37e779 /Src/mkbltnmlst.sh
parentc175751b501a3a4cb40ad4787340a597ea769be4 (diff)
downloadzsh-e74702b467171dbdafb56dfe354794a212e020d9.tar.gz
zsh-e74702b467171dbdafb56dfe354794a212e020d9.tar.xz
zsh-e74702b467171dbdafb56dfe354794a212e020d9.zip
Initial revision
Diffstat (limited to 'Src/mkbltnmlst.sh')
-rw-r--r--Src/mkbltnmlst.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
new file mode 100644
index 000000000..4a90ecd20
--- /dev/null
+++ b/Src/mkbltnmlst.sh
@@ -0,0 +1,60 @@
+#! /bin/sh
+#
+# mkbltnmlst.sh: generate boot code for linked-in modules
+#
+# Written by Andrew Main
+#
+srcdir=${srcdir-`echo $0|sed 's%/[^/][^/]*$%%'`}
+test "x$srcdir" = "x$0" && srcdir=.
+test "x$srcdir" = "x"   && srcdir=.
+MODBINS=${MODBINS-modules-bltin}
+XMODCF=${XMODCF-$srcdir/xmods.conf}
+
+bin_mods=" zsh "`sed 's/^/ /;s/$/ /' $MODBINS`
+x_mods=`cat $XMODCF`
+. ./modules.index
+
+trap "rm -f $1; exit 1" 1 2 15
+
+exec > $1
+
+echo "#ifdef DYNAMIC"
+for x_mod in $x_mods; do
+    case $bin_mods in
+	*" $x_mod "*) ;;
+	*)  echo "/* non-linked-in known module \`$x_mod' */"
+	    eval "loc=\$loc_$x_mod"
+	    unset moddeps autobins
+	    . $srcdir/../$loc/${x_mod}.mdd
+	    for bin in $autobins; do
+		echo "    add_autobin(\"$bin\", \"$x_mod\");"
+	    done
+	    for dep in $moddeps; do
+		case $bin_mods in
+		    *" $dep "*)
+			echo "    /* depends on \`$dep' */" ;;
+		    *)	echo "    add_dep(\"$x_mod\", \"$dep\");" ;;
+		esac
+	    done ;;
+    esac
+done
+echo "#endif /* DYNAMIC */"
+echo
+done_mods=" "
+for bin_mod in $bin_mods; do
+    echo "/* linked-in module \`$bin_mod' */"
+    eval "loc=\$loc_$bin_mod"
+    unset moddeps
+    . $srcdir/../$loc/${bin_mod}.mdd
+    for dep in $moddeps; do
+	case $done_mods in
+	    *" $dep "*)
+		echo "    /* depends on \`$dep' */" ;;
+	    *)	echo >&2 "ERROR: linked-in module \`$bin_mod' depends on \`$dep'"
+		rm -f $1
+		exit 1 ;;
+	esac
+    done
+    echo "    mod.nam = \"$bin_mod\"; boot_$bin_mod(&mod);"
+    done_mods="$done_mods$bin_mod "
+done