- Make sure you have these tools available:
- llvm tools (llvm-ld, llvm-as)
There is no install target, so just type
make'' at the top level. The resulting binary is calleddang'' and resides in the top-level directory.
You can produce executables with dang in two ways. The first is to compile every module independently, and link everything together, and the second is to build a binary that consists of just the Main module.
To achieve the first, compile each module using the -c flag. Make sure that you get the order right, as dang makes no effort to figure out module order, or compile things you've left out. Once everything is compiled, producing .o and .di files, you can link them and the runtime together using llvm-ld:
$ llvm-ld -o $RTS_PATH/librts.a Module_1.o [.. Module_n.o]
If you want to just compile a single module, producing a binary, you can use dang for the whole process.
$ dang Main.dg
If you would like to produce a native binary using dang, compile as normal, producing an llvm bitcode file (something.bc), then use llc to turn it into native assembly, and then assemble it with gcc.
$ llc .bc $ gcc -o <name.s>