From b1d222c3f14e7e621a10f0601cf619ee2419ad8a Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 31 May 2013 11:41:43 +0200 Subject: [PATCH] more modular build system, for thread-dependent or React-dependent modules --- .merlin | 1 + Makefile | 29 ++++++++++++++++++++--------- react_containers.mllib | 1 + react_containers.odocl | 1 + thread_containers.odocl | 1 + 5 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 react_containers.mllib create mode 100644 react_containers.odocl create mode 100644 thread_containers.odocl diff --git a/.merlin b/.merlin index c2c31100..90a8640d 100644 --- a/.merlin +++ b/.merlin @@ -8,3 +8,4 @@ PKG oUnit PKG bench PKG threads PKG threads.posix +PKG react diff --git a/Makefile b/Makefile index baf40928..326c4083 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,32 @@ INTERFACE_FILES = $(shell find -name '*.mli') IMPLEMENTATION_FILES = $(shell find -name '*.ml') TARGETS_LIB = containers.cmxa containers.cma -TARGET_THREAD_LIB = thread_containers.cmxa thread_containers.cma -TARGET_DOC = containers.docdir/index.html +TARGETS_DOC = containers.docdir/index.html EXAMPLES = examples/mem_size.native examples/collatz.native examples/crawl.native + OPTIONS = -use-ocamlfind -all: lib lib_thread doc +ENABLE_THREAD ?= yes +ENABLE_REACT ?= yes + +ifeq ($(ENABLE_THREAD), yes) + OPTIONS += -tag thread + TARGETS_LIB += thread_containers.cmxa thread_containers.cma + TARGETS_DOC += thread_containers.docdir/index.html +endif +ifeq ($(ENABLE_REACT), yes) + OPTIONS += -package react + TARGETS_LIB += react_containers.cmxa react_containers.cma + TARGETS_DOC += react_containers.docdir/index.html +endif + +all: lib lib: - ocamlbuild $(OPTIONS) $(TARGETS_LIB) $(TARGET_DOC) - -lib_thread: - ocamlbuild $(OPTIONS) $(TARGETS_LIB) $(TARGET_THREAD_LIB) $(TARGET_DOC) + ocamlbuild $(OPTIONS) $(TARGETS_LIB) $(TARGETS_DOC) doc: - ocamlbuild $(OPTIONS) $(TARGET_DOC) + ocamlbuild $(OPTIONS) $(TARGETS_DOC) examples: all ocamlbuild $(OPTIONS) -I . $(EXAMPLES) @@ -34,5 +45,5 @@ clean: tags: otags *.ml *.mli -.PHONY: all all_thread clean tests tags examples +.PHONY: all clean tests tags examples diff --git a/react_containers.mllib b/react_containers.mllib new file mode 100644 index 00000000..c0cedf8a --- /dev/null +++ b/react_containers.mllib @@ -0,0 +1 @@ +Behavior diff --git a/react_containers.odocl b/react_containers.odocl new file mode 100644 index 00000000..c0cedf8a --- /dev/null +++ b/react_containers.odocl @@ -0,0 +1 @@ +Behavior diff --git a/thread_containers.odocl b/thread_containers.odocl new file mode 100644 index 00000000..99668811 --- /dev/null +++ b/thread_containers.odocl @@ -0,0 +1 @@ +Future