Begin Jmk2 in TCL
diff --git a/share/jmk/jmk.tcl b/share/jmk/jmk.tcl
new file mode 100644
index 0000000..36c65a9
--- /dev/null
+++ b/share/jmk/jmk.tcl
@@ -0,0 +1,89 @@
+# Rewrite of JMK in TCL
+
+variable jmk_name {}
+variable jmk_target {}
+variable cflags {}
+variable asmflags {}
+
+variable asm as
+variable cc cc
+
+variable options
+
+proc init {name {target {DEFAULT_TARGET}}} {
+ if {$target eq {DEFAULT_TARGET}} {
+ set target $name
+ }
+
+ global jmk_name
+ global jmk_target
+
+ set jmk_name $name
+ set jmk_target $target
+}
+
+proc preset {p} {
+ ::preset::$p
+}
+
+proc presets {args} {
+ foreach arg $args {
+ preset $arg
+ }
+}
+
+proc cflag {arg} {
+ global cflags
+ set cflags "$cflags $arg"
+}
+
+proc cflags {args} {
+ foreach arg $args {
+ cflag $arg
+ }
+}
+
+proc asmflag {arg} {
+ global asmflags
+ set asmflags "$asmflags $arg"
+}
+
+proc asmflags {args} {
+ foreach arg $args {
+ asmflag $arg
+ }
+}
+
+proc option {name val} {
+ global options
+ if {![info exists options($name)]} {
+ set options($name) $val
+ }
+}
+
+namespace eval preset {
+ proc 32 {} {
+ cflag -m32
+ asmflag -felf32
+ }
+
+ proc debug {} {
+ cflag -g
+ asmflag -Fdwarf
+ }
+
+ proc warn {} {
+ cflag "-Wall -Wextra -Werror"
+ }
+
+ proc nasm {} {
+ global asm
+ set asm nasm
+ }
+}
+
+if {[catch {array set options $argv} msg]} {
+ puts "Sorry, you must pass an even number of arguments to this script"
+ puts "in the form <key> <value>"
+ exit 1
+}
diff --git a/src/lisp/Jmk2 b/src/lisp/Jmk2
new file mode 100644
index 0000000..17f1910
--- /dev/null
+++ b/src/lisp/Jmk2
@@ -0,0 +1,33 @@
+# -*- mode:tcl -*-
+
+source "../../share/jmk/jmk.tcl"
+
+init lisp
+
+presets 32 debug warn nasm
+cflags -Ivendor/luajit/dynasm -O0
+
+option NO_READLINE 0
+
+type executable
+
+if {$options(NO_READLINE) == 0} {
+ cflags -lreadline
+} else {
+ cflags -DNO_READLINE
+}
+
+set lua vendor/luajit/src/host/minilua
+
+rule $lua ${lua}.c {
+ log CC $source
+ cc $source -o $target -lm
+}
+
+rule compiler.c "compiler.dasc $lua" {
+ log DYNASM $first_source
+ shell $::lua vendor/luajit/dynasm/dynasm.lua -o $target $first_source
+}
+
+sources main.c lisp.c compiler.c lib/std.c plat/linux.c istream.c gc.c \
+ call_list.s error.c