Commit 7c0f5888 authored by Raphael Rieu-Helft's avatar Raphael Rieu-Helft

Convert debug_optim to a PPX

parent 188478ad
......@@ -43,6 +43,7 @@ INSTALL_DATA = @INSTALL_DATA@
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLDEP = @OCAMLDEP@
OCAMLFIND = @OCAMLFIND@
OCAMLLEX = @OCAMLLEX@
OCAMLYACC = @OCAMLYACC@
OCAMLDOC = @OCAMLDOC@
......@@ -294,16 +295,19 @@ endif
src/util/strings.cmo: WARNINGS:=$(WARNINGS)-3
src/util/strings.cmx: WARNINGS:=$(WARNINGS)-3
# compiler plugins
# debug optimisation ppx
ifeq (@enable_compiler_plugins@,yes)
src/util/debug_optim.cmxs: src/util/debug_optim.ml
ifeq (@enable_ppx@,yes)
src/util/ppx_debug_optim: src/util/debug_optim.ml
$(SHOW) 'Linking $@'
$(HIDE)$(OCAMLOPT) -I @COMPILERLIBS@ -shared src/util/debug_optim.ml -o $@
src/transform/reflection.cmx: src/util/debug_optim.cmxs
src/transform/reflection.cmx: OFLAGS += -plugin debug_optim.cmxs
src/mlw/mlinterp.cmx: src/util/debug_optim.cmxs
src/mlw/mlinterp.cmx: OFLAGS += -plugin debug_optim.cmxs
$(HIDE) $(OCAMLFIND) opt -package compiler-libs.common -linkpkg src/util/debug_optim.ml -o $@
src/transform/reflection.cmx: src/util/ppx_debug_optim
src/transform/reflection.cmx: OFLAGS += -ppx src/util/ppx_debug_optim
src/mlw/mlinterp.cmx: src/util/ppx_debug_optim
src/mlw/mlinterp.cmx: OFLAGS += -ppx src/util/ppx_debug_optim
clean::
rm -f src/util/ppx_debug_optim
endif
# build targets
......
......@@ -336,35 +336,25 @@ fi
#if ocamlfind is used it gives the install path for ocaml library
if test "$USEOCAMLFIND" = yes; then
OCAMLINSTALLLIB=$(ocamlfind printconf destdir)
OCAMLFIND=ocamlfind
else
OCAMLINSTALLLIB=$OCAMLLIB
OCAMLFIND=no
fi
# compiler plugins
# ppx
AX_VERSION_GE([$OCAMLVERSION], 4.05.0,
[if test "$USEOCAMLFIND" = yes; then
COMPILERLIBS=$(ocamlfind query compiler-libs)
fi
if test -n "$COMPILERLIBS"; then
echo "ocamlfind found compiler-libs in $COMPILERLIBS"
enable_compiler_plugins="yes"
else
COMPILERLIBS="+compiler-libs"
AC_CHECK_FILE($OCAMLLIB/compiler-libs/,
enable_compiler_plugins=yes,
enable_compiler_plugins=no)
if test "$enable_compiler_plugins" = no; then
reason_compiler_plugins=" (compiler-libs not found)"
fi
fi],
[enable_compiler_plugins="no"
reason_compiler_plugins=" (Ocaml version 4.05.0 required)"])
if test "$enable_compiler_plugins" = yes; then
COMPILERLIBSPKG="compiler-libs"
if test "$USEOCAMLFIND" = yes; then
COMPILERLIBS=$(ocamlfind query compiler-libs)
if test -n "$COMPILERLIBS"; then
echo "ocamlfind found compiler-libs in $COMPILERLIBS"
enable_ppx=yes
else
enable_ppx=no
reason_ppx=" (compiler-libs not found)"
fi
else
COMPILERLIBSPKG=
enable_ppx=no
fi
# checking for rubber or latexmk or pdflatex
......@@ -944,6 +934,7 @@ AC_SUBST(STRIP)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLFIND)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLDOC)
......@@ -971,9 +962,7 @@ AC_SUBST(JSOFOCAMLPKG)
AC_SUBST(META_OCAMLGRAPH)
AC_SUBST(enable_compiler_plugins)
AC_SUBST(COMPILERLIBS)
AC_SUBST(COMPILERLIBSPKG)
AC_SUBST(enable_ppx)
AC_SUBST(NUMINCLUDE)
AC_SUBST(MLMPFRINCLUDE)
......@@ -1073,7 +1062,7 @@ echo " Version : $OCAMLVERSION"
echo " Library path : $OCAMLLIB"
echo " Native compilation : $enable_native_code"
echo " Profiling : $enable_profiling"
echo " Compiler plugins : $enable_compiler_plugins$reason_compiler_plugins"
echo " PPX : $enable_ppx$reason_ppx"
echo " Javascript support : $enable_js_of_ocaml$reason_js_of_ocaml"
echo " Mpfr support : $found_mlmpfr$reason_mlmpfr"
echo "Components"
......
......@@ -14,7 +14,7 @@ open Ast_mapper
open Asttypes
open Longident
let ast_mapper =
let ast_mapper argv =
{ Ast_mapper.default_mapper with
expr = fun mapper expr ->
match expr with
......@@ -32,7 +32,4 @@ let ast_mapper =
None
| other -> default_mapper.expr mapper other; }
let transform _hook_info structure =
ast_mapper.structure ast_mapper structure
let () = Pparse.ImplementationHooks.add_hook "Debug hook" transform
let () = register "Debug hook" ast_mapper
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