Skip to content

Commit

Permalink
Enhancements to build control process
Browse files Browse the repository at this point in the history
  • Loading branch information
mdekstrand committed Apr 10, 2010
1 parent 6641892 commit 93c9ece
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
16 changes: 11 additions & 5 deletions Makefile
Expand Up @@ -3,28 +3,34 @@

NAME = batteries
VERSION = 1.1.0
DOCROOT ?= /usr/share/doc/ocaml-batteries
BROWSER_COMMAND ?= x-www-browser %s

OCAMLBUILD ?= ocamlbuild

NATIVE_ENABLED ?= yes
BATTERIES_NATIVE ?= yes

.PHONY: all clean doc

all: build/META
test ! -e src/batteries_config.ml || rm src/batteries_config.ml
$(OCAMLBUILD) syntax.otarget byte.otarget src/batteries_help.cmo
if [ X$(NATIVE_ENABLED) = Xyes ]; then \
$(OCAMLBUILD) native.otarget; \
fi
test X$(BATTERIES_NATIVE) != Xyes || $(OCAMLBUILD) native.otarget

clean:
rm -f build/META apidocs
$(OCAMLBUILD) -clean

doc:
$(OCAMLBUILD) batteries.docdir/index.html
[ -e apidocs ] || ln -s _build/batteries.docdir apidocs
test -e apidocs || ln -s _build/batteries.docdir apidocs

build/META: build/META.in
sed -e 's|@VERSION@|$(VERSION)|' \
build/META.in > build/META

src/batteries_config.ml: src/batteries_config.mlp
sed -e 's|@VERSION@|$(VERSION)|' \
-e 's|@DOCROOT@|$(DOCROOT)|' \
-e 's|@BROWSER_COMMAND@|$(BROWSER_COMMAND)|' \
src/batteries_config.mlp >src/batteries_config.ml
14 changes: 7 additions & 7 deletions README
Expand Up @@ -17,26 +17,26 @@ Batteries Included serves the following purposes:
**** Requirements ****
You will need
* OCaml >= 3.11
* OMake (http://omake.metaprl.org/index.html)
* Findlib >= 1.2.5 (http://projects.camlcity.org/projects/findlib.html/)
* make (optional; aids build and installation)
* Camomile >= 0.7 (http://camomile.sourceforge.net/)
* OUnit to build and run the tests

**** Configuration and installation ****

To install the full version of OCaml Batteries Included, execute

$ omake all
$ omake test [ optional ]
$ sudo omake install
$ make all
$ make test [ optional ]
$ sudo make install

$ omake doc [ optional ]
$ sudo omake install-doc [ optional ]
$ make doc [ optional ]
$ sudo make install-doc [ optional ]

If you want the documentation installed elsewhere, set this *before*
starting the build process (it becomes part of batteries_config.ml).

$ export BATTERIES_DOCROOT=/path/to/new/docroot/
$ export DOCROOT=/path/to/new/docroot/

If you want findlib to use a -destdir argument to [ocamlfind install], set

Expand Down
7 changes: 7 additions & 0 deletions myocamlbuild.ml
Expand Up @@ -18,6 +18,13 @@ let _ = dispatch begin function
Options.ocamldep := ocamlfind "ocamldep";
Options.ocamldoc := ocamlfind "ocamldoc";
Options.ocamlmktop := ocamlfind "ocamlmktop"
| Before_rules ->
rule "preprocess config file"
~prod:"%.ml"
~deps:["%.mlp"; "Makefile"]
begin fun env build ->
Cmd(S[A"make"; P(env "%.ml")])
end
| After_rules ->
flag ["ocaml"; "compile"] & S[A"-package"; A packs];
flag ["ocaml"; "ocamldep"] & S[A"-package"; A packs];
Expand Down

0 comments on commit 93c9ece

Please sign in to comment.