Add standard library
[kaleidoscope-hs.git] / Makefile
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..1a37353
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,14 @@
+stdlib.dylib: stdlib.c
+       clang -shared $< -o $@
+
+# for statically linking the stdlib:
+# make sure to change in Main.hs
+#   loadLibraryPermanently (Just "stdlib.dylib")
+# to
+#   loadLibraryPermanently Nothing
+stdlib.o: stdlib.c
+       clang -c $< -o $@
+
+Main: Main.hs stdlib.o
+       ghc $^ -o $@ -optl -Wl,-exported_symbols_list,stdlib.syms \
+               -no-keep-hi-files -no-keep-o-files