Development

This page shows you how to build and test Subverge (you need gcc and nasm, you've been warned) and where each part of it lives in the source tree.

Building

$ make                build/subverge.elf
$ make run            boot it in QEMU
$ make iso            build/subverge.iso
$ make run-iso        boot the ISO in QEMU

The Makefile links the kernel as a 64-bit ELF and converts it to ELF32, because QEMU's -kernel option only accepts ELF32. Everything in root/ is concatenated into one blob, linked into the kernel and read at boot. The ISO is made with grub-mkrescue and a generated grub.cfg that loads the kernel with multiboot.

The build needs gcc, binutils, nasm and qemu-system-x86, and the ISO additionally needs grub-mkrescue, xorriso and grub-pc-bin.

Testing

Run the tests, or you'll be debugging this shit at 3am.

$ make host           the omega interpreter as a Linux program
$ make stress         the same, with a GC pass before every word
$ make jit-test       boot QEMU and run the JIT test script

make host builds the interpreter from the same source as an ordinary Linux program. test/host.c wraps it with a fake screen and keyboard, so the screen, keyboard, disassembler and documentation can be tested without starting a VM. Lines on stdin are typed into it, and a few directives control it:

@screen      dump the screen
@keys        queue keys
@roundtrip   save a world and reload it
@dis name    dump compiled code
@docs        check help against the dictionary

printf '@docs\n' | build/host must print 0 problems. This is how the build detects a word with no help entry.

test/qdrive.c boots Subverge, types the scripts in test/*.qd through the QEMU monitor and writes the PNG screenshots used in the tour.

Source layout

Here's where everything lives, in case you want to go digging.

The directories of the source tree are listed here.

See also