summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Glondu <steph@glondu.net>2016-08-03 13:20:59 +0200
committerStephane Glondu <steph@glondu.net>2016-08-03 13:20:59 +0200
commit5dbf430b590f83452e52444126735371f76eedd8 (patch)
tree1cd295dc50b2d5fc4cb6c1a55a37011213609926
parentbf001ec087320a1f830e63d15263440c62c6e238 (diff)
parentc85b0921f35cec79e437eb253be4fa73e44c41e4 (diff)
Merge tag 'upstream/1.0.12'
Upstream version 1.0.12
-rw-r--r--.gitignore14
-rw-r--r--Makefile90
-rw-r--r--README.md7
3 files changed, 81 insertions, 30 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..76fa4f8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+*~
+*.cm[ioxat]
+*.[oa]
+*.cmx[as]
+*.cmti
+*.annot
+META
+bdump
+test-stream.dat
+test2.bin
+*.byte
+*.native
+*.exe
+test_biniou
diff --git a/Makefile b/Makefile
index 824ed3b..a398630 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,48 @@
-VERSION = 1.0.9
+VERSION = 1.0.12
-FLAGS = -dtypes -g
+FLAGS = -g -annot -bin-annot
PACKS = easy-format
-ifeq "$(shell ocamlc -config |grep os_type)" "os_type: Win32"
+ifeq "$(shell ocamlfind ocamlc -config |grep os_type)" "os_type: Win32"
EXE=.exe
else
EXE=
endif
-NATDYNLINK := $(shell if [ -f `ocamlc -where`/dynlink.cmxa ]; then echo YES; else echo NO; fi)
+BEST = $(shell \
+ if ocamlfind ocamlopt 2>/dev/null; then \
+ echo .native; \
+ else \
+ echo .byte; \
+ fi \
+)
+
+NATDYNLINK = $(shell \
+ if [ -f `ocamlfind ocamlc -where`/dynlink.cmxa ]; then \
+ echo YES; \
+ else \
+ echo NO; \
+ fi \
+)
ifeq "${NATDYNLINK}" "YES"
CMXS=biniou.cmxs
endif
-.PHONY: default all opt install doc test
-default: all opt test_biniou$(EXE) META
-all: biniou.cma
-opt: biniou.cmxa $(CMXS) bdump$(EXE)
+.PHONY: default all byte opt install doc test
+default: all test_biniou$(EXE)
+
+ifeq "$(BEST)" ".native"
+all: byte opt doc META
+else
+all: byte doc META
+endif
+
+byte: biniou.cma bdump.byte
+opt: biniou.cmxa $(CMXS) bdump.native
test: test_biniou$(EXE)
- ./test_biniou
+ ./$<
ifndef PREFIX
PREFIX = $(shell dirname $$(dirname $$(which ocamlfind)))
@@ -44,7 +65,9 @@ SOURCES = bi_util.mli bi_util.ml \
MLI = $(filter %.mli, $(SOURCES))
ML = $(filter %.ml, $(SOURCES))
-CMI = $(ML:.ml=.cmi)
+CMI = $(MLI:.mli=.cmi)
+CMT = $(MLI:.mli=.cmt)
+ANNOT = $(MLI:.mli=.annot)
CMO = $(ML:.ml=.cmo)
CMX = $(ML:.ml=.cmx)
O = $(ML:.ml=.o)
@@ -58,40 +81,51 @@ biniou.cmxa: $(SOURCES) Makefile
-o biniou.cmxa -package "$(PACKS)" $(SOURCES)
biniou.cmxs: biniou.cmxa
- ocamlopt -shared -linkall -I . -o biniou.cmxs biniou.cmxa
+ ocamlfind ocamlopt -shared -linkall -I . -o $@ $^
-bdump$(EXE): $(SOURCES) bdump.ml
- ocamlfind ocamlopt -o bdump$(EXE) $(FLAGS) \
- -package $(PACKS) -linkpkg \
- biniou.cmxa bdump.ml
+bdump.byte: biniou.cma bdump.ml
+ ocamlfind ocamlc -o $@ $(FLAGS) \
+ -package $(PACKS) -linkpkg $^
-test_biniou$(EXE): biniou.cmxa test_biniou.ml
- ocamlfind ocamlopt -o test_biniou$(EXE) $(FLAGS) \
- -package "$(PACKS) unix" -linkpkg \
- biniou.cmxa test_biniou.ml
+bdump.native: biniou.cmxa bdump.ml
+ ocamlfind ocamlopt -o $@ $(FLAGS) \
+ -package $(PACKS) -linkpkg $^
+
+test_biniou.byte: biniou.cma test_biniou.ml
+ ocamlfind ocamlc -o $@ $(FLAGS) \
+ -package "$(PACKS) unix" -linkpkg $^
+
+test_biniou.native: biniou.cmxa test_biniou.ml
+ ocamlfind ocamlopt -o $@ $(FLAGS) \
+ -package "$(PACKS) unix" -linkpkg $^
+
+%$(EXE): %$(BEST)
+ cp $< $@
doc: doc/index.html
doc/index.html: $(MLI)
mkdir -p doc
ocamlfind ocamldoc -d doc -html -package easy-format $(MLI)
-install: META
- test ! -f bdump || cp bdump $(BINDIR)/
- test ! -f bdump.exe || cp bdump.exe $(BINDIR)/
+install: META byte
+ if [ -f bdump.native ]; then \
+ cp bdump.native $(BINDIR)/bdump$(EXE); \
+ else \
+ cp bdump.byte $(BINDIR)/bdump$(EXE); \
+ fi
ocamlfind install biniou META \
- $$(ls $(MLI) $(CMI) $(CMO) $(CMX) $(O) \
- biniou.cma biniou.cmxa biniou.cmxs biniou.a)
+ $(MLI) $(CMI) $(CMT) $(ANNOT) $(CMO) biniou.cma \
+ -optional $(CMX) $(O) biniou.cmxa biniou.a biniou.cmxs
uninstall:
- test ! -f $(BINDIR)/bdump || rm $(BINDIR)/bdump
- test ! -f $(BINDIR)/bdump.exe || rm $(BINDIR)/bdump.exe
+ rm -f $(BINDIR)/bdump{.exe,}
ocamlfind remove biniou
.PHONY: clean
clean:
- rm -f *.o *.a *.cm[ioxa] *.cmxa *~ *.annot
- rm -f bdump bdump.exe test_biniou test_biniou.exe META
+ rm -f *.o *.a *.cm[ioxa] *.cmxa *~ *.annot META
+ rm -f {bdump,test_biniou}{.exe,.byte,.native,}
rm -rf doc
rm -f test.bin test_channels.bin
diff --git a/README.md b/README.md
index 3c6f879..193adc8 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,9 @@ of type definitions except for field and variant names which are
represented by 31-bit hashes. A program named `bdump` is provided for
routine visualization of biniou data files.
-The program [atdgen](https://github.com/MyLifeLabs/atdgen)
-can be used to derive OCaml-Biniou serializers and
+The program [atdgen](https://mjambon.github.io/atdgen-doc/)
+is used to derive OCaml-Biniou serializers and
deserializers from type definitions.
+
+Biniou format specification:
+https://mjambon.github.io/atdgen-doc/biniou-format.txt