Browse files

Refactor so compiling binaries is easier

  • Loading branch information...
1 parent 8e58ce7 commit 5dc98959e617f86dfc964bfa3026ca335d6e9100 orbitz committed Mar 10, 2013
Showing with 14 additions and 17 deletions.
  1. +3 −6 examples/.gitignore
  2. +5 −11 examples/Makefile
  3. +6 −0 lib/Ocamlrules.mk.in
View
9 examples/.gitignore
@@ -1,6 +1,3 @@
-ping
-ping.byte
-client_id
-client_id.byte
-server_info
-server_info.byte
+*.native
+*.byte
+
View
16 examples/Makefile
@@ -22,34 +22,28 @@ all: native byte
native-code: native
-native: ping client_id server_info
+native: ping.native client_id.native server_info.native
-ping: ping.cmx
- ocamlfind ocamlopt $(OCAMLOPT_OPTS) -thread -linkpkg -o $@ $^
+ping.native: ping.cmx
-client_id: client_id.cmx
- ocamlfind ocamlopt $(OCAMLOPT_OPTS) -thread -linkpkg -o $@ $^
+client_id.native: client_id.cmx
-server_info: server_info.cmx
- ocamlfind ocamlopt $(OCAMLOPT_OPTS) -thread -linkpkg -o $@ $^
+server_info.native: server_info.cmx
byte-code: byte
byte: ping.byte client_id.byte server_info.byte
ping.byte: ping.cmo
- ocamlfind ocamlc $(OCAMLC_OPTS) -thread -custom -linkpkg -o $@ $^
client_id.byte: client_id.cmo
- ocamlfind ocamlc $(OCAMLC_OPTS) -thread -custom -linkpkg -o $@ $^
server_info.byte: server_info.cmo
- ocamlfind ocamlc $(OCAMLC_OPTS) -thread -custom -linkpkg -o $@ $^
test:
clean:
- -rm -f ping ping.byte client_id client_id.byte *.cmx *.cmo *.o
+ -rm -f *.native *.byte *.cmx *.cmo *.o
# Dependencies
include ../lib/Ocamlrules.mk.in
View
6 lib/Ocamlrules.mk.in
@@ -14,6 +14,12 @@
%.cmo: %.ml
ocamlfind ocamlc -thread -I +camlp4 $(OCAMLC_OPTS) $(CAMLP4) -c $(patsubst %.cmo,%.ml,$@)
+%.native: %.cmx
+ ocamlfind ocamlopt $(OCAMLOPT_OPTS) -thread -linkpkg -o $@ $^
+
+%.byte: %.cmo
+ ocamlfind ocamlc $(OCAMLC_OPTS) -thread -custom -linkpkg -o $@ $^
+
.d: $(sources) $(sources_mli)
ocamlfind ocamldep $(OCAMLC_OPTS) $(CAMLP4) $(sources) $(sources_mli) > .d

0 comments on commit 5dc9895

Please sign in to comment.