.
authorKim Nguyễn <kn@lri.fr>
Thu, 3 Mar 2016 11:33:36 +0000 (12:33 +0100)
committerKim Nguyễn <kn@lri.fr>
Thu, 3 Mar 2016 11:33:36 +0000 (12:33 +0100)
Makefile.in
configure.in
myocamlbuild.ml

index 860c877..8da1e31 100644 (file)
@@ -1,6 +1,5 @@
 CAMLP4FLAGS=@CAMLP4FLAGS@
 CAMLP4FLAGS=@CAMLP4FLAGS@
-PPOPTSFLAGS= $($CAMLP4FLAGS:%=ppopt(%))
-OCAMLBUILDFLAGS=-j 0 -use-ocamlfind @OCAMLBUILDFLAGS@
+OCAMLBUILDFLAGS=-j 0 -use-ocamlfind @OCAMLBUILDFLAGS@  $(CAMLP4FLAGS:%=-tag %)
 OCAMLBUILD=@OCAMLBUILD@
 PACKAGE = @PACKAGE_TARNAME@
 TARGETS=tatoo.native
 OCAMLBUILD=@OCAMLBUILD@
 PACKAGE = @PACKAGE_TARNAME@
 TARGETS=tatoo.native
@@ -17,7 +16,7 @@ all: $(TARGETS)
        @
 
 %:
        @
 
 %:
-       @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS)  $(PPOPTFLAGS:%=-tag %) $@
+       @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS)  $@
 
 clean:
        @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS) -clean
 
 clean:
        @ $(OCAMLBUILD) $(OCAMLBUILDFLAGS) -clean
index d9a9133..0adc970 100644 (file)
@@ -179,7 +179,7 @@ AC_ARG_ENABLE([debug],
 
 if test "x$DEBUG" = "xyes"; then
    OCAMLBUILDFLAGS="$OCAMLBUILDFLAGS -tag debug"
 
 if test "x$DEBUG" = "xyes"; then
    OCAMLBUILDFLAGS="$OCAMLBUILDFLAGS -tag debug"
-   CAMLP4FLAGS="$CAMLP4FLAGS -D DEBUG"
+   CAMLP4FLAGS="$CAMLP4FLAGS ppopt\(-D\) ppopt\(DEBUG\)"
 fi
 
 #profiling
 fi
 
 #profiling
@@ -200,7 +200,7 @@ AC_ARG_ENABLE([trace],
               [TRACE=no])
 
 if test "x$TRACE" = "xyes"; then
               [TRACE=no])
 
 if test "x$TRACE" = "xyes"; then
-   CAMLP4FLAGS="$CAMLP4FLAGS -D HTMLTRACE"
+   CAMLP4FLAGS="$CAMLP4FLAGS ppopt\(-D\) ppopt\(HTMLTRACE\)"
 fi
 
 #inlining
 fi
 
 #inlining
@@ -217,7 +217,7 @@ AC_ARG_ENABLE([unsafe],
               [UNSAFE=0])
 
 if test "x$UNSAFE" = "xyes"; then
               [UNSAFE=0])
 
 if test "x$UNSAFE" = "xyes"; then
-   CAMLP4FLAGS="$CAMLP4FLAGS -unsafe"
+   CAMLP4FLAGS="$CAMLP4FLAGS ppopt\(-unsafe\)"
 fi
 
 
 fi
 
 
index 5d04a11..7f86523 100644 (file)
@@ -2,13 +2,25 @@ open Ocamlbuild_plugin ;;
 
 let includes = [ "include/utils.ml"; "include/utils32.ml"; "include/utils64.ml"; "include/debug.ml" ]
 
 
 let includes = [ "include/utils.ml"; "include/utils32.ml"; "include/utils64.ml"; "include/debug.ml" ]
 
+let ml_str_rule () =
+   rule ".ml.str" ~dep:"%.ml.str" ~prod:"%.ml"
+    (fun env _ ->
+     let mlstr = env "%.ml.str" and ml = env "%.ml" in
+     let cmd = Printf.sprintf "echo -n 'let content = \"' > %s ;\ 
+               sed -e 's/\\([\"\\\\]\\)/\\\\\\1/g' %s | sed -e 's/^\\(.*\\)$/\\1\\\\n\\\\/g' >> %s ;\
+                echo '' >> %s ;\
+                echo '\"' >> %s" ml mlstr ml ml ml
+     in
+     Cmd ( Sh cmd ))
+        
 let () =
   dispatch begin function
              | After_rules ->
                 dep ["ocaml";"compile";] includes;
                 dep ["ocaml";"ocamldep"; ] includes;
 let () =
   dispatch begin function
              | After_rules ->
                 dep ["ocaml";"compile";] includes;
                 dep ["ocaml";"ocamldep"; ] includes;
-                pflag ["ocaml";"compile";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]);
+                pflag ["ocaml";"compile";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]);            
                 pflag ["ocaml";"ocamldep";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]);
                 pflag ["ocaml";"ocamldep";] "ppopt" (fun s -> S [A"-ppopt"; A (s)]);
+               ml_str_rule ()
              | _ -> ()
 
 end;;
              | _ -> ()
 
 end;;