Commit d99c7fc7 authored by Maximilien Colange's avatar Maximilien Colange

Fix build error, due to the lack of flexibility of ocamlbuild to declare...

Fix build error, due to the lack of flexibility of ocamlbuild to declare proper order of linked objects
parent a3874283
......@@ -8,7 +8,6 @@ BUILDDIR=_build
OCAMLBUILD=ocamlbuild -use-ocamlfind -classic-display -build-dir $(BUILDDIR) @OCAMLBUILDFLAGS@
CXX_FLAGS=-std=c++11 @TIAMO_MACROS@ -I$(UTAP_INCLUDEDIR) -I@abs_top_srcdir@/src
......@@ -21,8 +20,13 @@ all-local: tiamo
tiamo: src/main.native
cp `readlink -f $(BUILDDIR)/$<` tiamo
src/main.native: src/timedAutomatonBuilder.o
CXX_FLAGS="$(CXX_FLAGS)" $(OCAMLBUILD) -cflags "-I $(INCLUDEDIR)" -lflags "$(INCLUDEDIR)/udbml.cmxa $(UTAP_LIB) $(XML_LINK_FLAGS) -cclib -L$(INCLUDEDIR)" $@
CXX_FLAGS="$(CXX_FLAGS)" $(OCAMLBUILD) -cflags "-I $(INCLUDEDIR)" -lflags "$(INCLUDEDIR)/udbml.cmxa $(XML_LINK_FLAGS) -cclib -L$(INCLUDEDIR)" $@
$(OCAMLBUILD) -clean
......@@ -28,17 +28,9 @@ let ocaml_cxx_flags = fun flags ->
let camlflags = List.flatten ( (fun opt -> ["-ccopt"; opt]) flags) in
atomize camlflags
(* TODO add C options when seeing tags:
* noassert -> add '-DNDEBUG'
* This kind of tags (debug, noassert, optimization levels...) should be set
* by the configure script through the file.
let _ =
dispatch begin function
| After_rules ->
(* TODO declare the internal utap library here *)
(* a custom noassert flag, only for compilation, not preprocessing *)
flag ["compile";"noassert"] (A"-noassert");
......@@ -48,8 +40,12 @@ let _ =
flag ["c++";"debug"] (ocaml_cxx_flags ["-g"]);
flag ["c++";"noassert"] (ocaml_cxx_flags ["-DNDEBUG"]);
(* explicit link dependency for C-based object files *)
pdep ["link"] "linkdep" (fun param -> [param])
(* hard-coding the C file and utap library seems the easiest way
* to avoid problems in object ordering at link time.
* Unfortunately, the dependency is not handled through ocamlbuild,
* but in the Makefile directly.
flag ["ocaml"; "link"; "native"] (S[P"src/timedAutomatonBuilder.o"; A"-cclib"; A("-L"^(Pathname.pwd / "utap/src")); A"-cclib"; A"-lutap"]);
| _ -> ()
<*>: bin_annot
<*.c> or <*.cm{o,x}> or <main.native>: custom @OCAMLTAGS@
<main.native>: use_dynlink, linkdep(src/timedAutomatonBuilder.o)
<main.native>: use_dynlink
<>: pp(camlp4o pa_macro.cmo @TIAMO_MACROS@)
<timedAutomatonBuilder.c>: c++
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment