Browse Source

[ocaml-c] Separate compilation

rexim 6 years ago
parent
commit
ba872eb529
2 changed files with 12 additions and 5 deletions
  1. 2 1
      ocaml-c/.gitignore
  2. 10 4
      ocaml-c/Makefile

+ 2 - 1
ocaml-c/.gitignore

@@ -5,4 +5,5 @@
 *.o
 *.a
 *.cmx
-hello.opt
+hello.opt
+hello

+ 10 - 4
ocaml-c/Makefile

@@ -1,5 +1,11 @@
-hello: hello_stubs.c hello.ml
-	ocamlc -o hello.opt hello.ml hello_stubs.c
+hello: hello.cmo dllhello_stubs.so
+	ocamlc -o hello hello.cmo -dllib dllhello_stubs.so
 
-hello.opt: hello_stubs.c hello.ml
-	ocamlopt -o hello.opt hello.ml hello_stubs.c
+hello.cmo: hello.ml
+	ocamlc -c  hello.ml
+
+dllhello_stubs.so: hello_stubs.o
+	ocamlmklib -o hello_stubs hello_stubs.o
+
+hello_stubs.o: hello_stubs.c
+	ocamlc -c hello_stubs.c