summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pouillard <np@nicolaspouillard.fr>2007-03-01 14:40:11 +0000
committerNicolas Pouillard <np@nicolaspouillard.fr>2007-03-01 14:40:11 +0000
commit8a8e9657e4ef4b38350aac1492b3d762c868c6af (patch)
treee7f6023e5145719cae6d7b7d714488020fb40932
parentef8d50b6c2b19bedf07cec5e12cdc4c447e576b5 (diff)
[ocamlbuild] See ChangeLog
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7951 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--ocamlbuild/ChangeLog32
-rw-r--r--ocamlbuild/FAQ35
-rw-r--r--ocamlbuild/glob.ml13
-rw-r--r--ocamlbuild/main.ml25
-rw-r--r--ocamlbuild/ocaml_specific.ml4
5 files changed, 94 insertions, 15 deletions
diff --git a/ocamlbuild/ChangeLog b/ocamlbuild/ChangeLog
index 57544feb3..9fb7d0670 100644
--- a/ocamlbuild/ChangeLog
+++ b/ocamlbuild/ChangeLog
@@ -1,3 +1,35 @@
+2007-03-01 Nicolas Pouillard <nicolas.pouillard@gmail.com>
+
+ Remove a rec.
+
+ * glob.ml: Parse is not rec.
+
+2007-03-01 Nicolas Pouillard <nicolas.pouillard@gmail.com>
+
+ true: traverse and FAQ.
+
+ * main.ml: Move the inital config upper to be loaded before the others
+ and hygiene.
+ * FAQ: New.
+
+2007-02-28 Nicolas Pouillard <nicolas.pouillard@gmail.com>
+
+ Improve the glob dir handling.
+
+ * glob.ml: Extend the ast instead of parsing an extended string.
+
+2007-02-28 Nicolas Pouillard <nicolas.pouillard@gmail.com>
+
+ Ensure that the whole boolean expression is only valid in the directory.
+
+ * glob.ml: Ditto.
+
+2007-02-28 Nicolas Pouillard <nicolas.pouillard@gmail.com>
+
+ Put -g on link only for programs.
+
+ * ocaml_specific.ml: Ditto.
+
2007-02-26 Berke Durak <berke.durak@inria.fr>
Added disclaimer to default rules table.
diff --git a/ocamlbuild/FAQ b/ocamlbuild/FAQ
new file mode 100644
index 000000000..b71516b9e
--- /dev/null
+++ b/ocamlbuild/FAQ
@@ -0,0 +1,35 @@
+Q: I've a directory with examples and I want build all of them easily?
+
+R:
+
+ You can use an .itarget file listing all products that you want.
+
+ $ cat examples.itarget
+ examples/a.byte
+ examples/b.byte
+
+ $ ocamlbuild examples.otarget
+
+ You can also have a dynamic rule that read the examples directory:
+
+ $ cat myocamlbuild.ml
+ open Ocamlbuild_plugin;;
+
+ dispatch begin function
+ | After_rules ->
+ let examples =
+ Array.fold_right begin fun f acc ->
+ if Pathname.get_extension f = "ml" then
+ ("examples" / Pathname.update_extension "byte" f) :: acc
+ else
+ acc
+ end (Pathname.readdir "examples") []
+ in
+ rule "All examples"
+ ~prod:"examples.otarget"
+ ~deps:examples
+ (fun _ _ -> Command.Nop)
+ | _ -> ()
+ end
+
+ $ ocamlbuild examples.otarget
diff --git a/ocamlbuild/glob.ml b/ocamlbuild/glob.ml
index 8003dbbb8..4be91ad53 100644
--- a/ocamlbuild/glob.ml
+++ b/ocamlbuild/glob.ml
@@ -305,6 +305,17 @@ let add_dir dir x =
Pattern(Concat(Word(My_std.filename_concat dir ""), p))
;;
(* ***)
+(*** add_ast_dir *)
+let add_ast_dir dir x =
+ match dir with
+ | None -> x
+ | Some dir ->
+ let slash = Class(Atom('/','/')) in
+ let any = Class True in
+ let q = Union[Epsilon; Concat(slash, Star any)] in (* ( /** )? *)
+ And[Atom(Pattern(ref (Brute(ref 0, Concat(Word dir, q))))); x]
+;;
+(* ***)
(*** parse *)
let parse ?dir u =
let l = Lexing.from_string u in
@@ -361,7 +372,7 @@ let parse ?dir u =
in
let x = parse_s () in
read EOF;
- x
+ add_ast_dir dir x
;;
(* ***)
(*** eval *)
diff --git a/ocamlbuild/main.ml b/ocamlbuild/main.ml
index 17b60b199..967c7c373 100644
--- a/ocamlbuild/main.ml
+++ b/ocamlbuild/main.ml
@@ -73,6 +73,19 @@ let proceed () =
let target_dirs = List.union [] (List.map Pathname.dirname !Options.targets) in
+ Configuration.parse_string
+ "true: traverse
+ <**/*.ml> or <**/*.mli> or <**/*.mlpack> or <**/*.ml.depends>: ocaml
+ <**/*.byte>: ocaml, byte, program
+ <**/*.odoc>: ocaml, doc
+ <**/*.native>: ocaml, native, program
+ <**/*.cma>: ocaml, byte, library
+ <**/*.cmxa>: ocaml, native, library
+ <**/*.cmo>: ocaml, byte
+ <**/*.cmi>: ocaml, byte, native
+ <**/*.cmx>: ocaml, native
+ ";
+
let newpwd = Sys.getcwd () in
Sys.chdir Pathname.pwd;
let entry_include_dirs = ref [] in
@@ -134,18 +147,6 @@ let proceed () =
end;
Resource.Cache.init ();
- Configuration.parse_string
- "<**/*.ml> or <**/*.mli> or <**/*.mlpack> or <**/*.ml.depends>: ocaml
- <**/*.byte>: ocaml, byte, program
- <**/*.odoc>: ocaml, doc
- <**/*.native>: ocaml, native, program
- <**/*.cma>: ocaml, byte, library
- <**/*.cmxa>: ocaml, native, library
- <**/*.cmo>: ocaml, byte
- <**/*.cmi>: ocaml, byte, native
- <**/*.cmx>: ocaml, native
- ";
-
Sys.catch_break true;
show_tags ();
diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
index 6beafc0c1..7c4c91b18 100644
--- a/ocamlbuild/ocaml_specific.ml
+++ b/ocamlbuild/ocaml_specific.ml
@@ -340,10 +340,10 @@ ocaml_lib ~extern:true ~dir:"+ocamldoc" "ocamldoc";;
ocaml_lib ~extern:true ~dir:"+ocamlbuild" "ocamlbuild";;
flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
-flag ["ocaml"; "debug"; "link"; "byte"] (A "-g");;
+flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "compile"; "native"] (A "-g");;
-flag ["ocaml"; "debug"; "link"; "native"] (A "-g");;
+flag ["ocaml"; "debug"; "link"; "native"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "native"] (A "-g");;
flag ["ocaml"; "dtypes"; "compile"] (A "-dtypes");;
flag ["ocaml"; "rectypes"; "compile"] (A "-rectypes");;