Skip to content

Commit

Permalink
flambda-backend: Add Make/Dune target for debug printers (#1289)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemaurer authored Jun 7, 2023
1 parent 324f32e commit 1deb5af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile.common-jst
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,10 @@ hacking-emacs-poller: _build/_bootinstall
hacking-emacs-builder: _build/_bootinstall
$(dune) rpc build $(ws_boot) -w $(boot_targets)
$(dune) diagnostics

.PHONY: debug-printers
debug-printers: runtime-stdlib # required for $(ws_main) to work
$(dune) build $(ws_main) $(ocamldir)/tools/debug_printers
@echo
@echo To load into ocamldebug, use:
@echo source \"$$(realpath _build/main/$(ocamldir)/tools/debug_printers)\"
17 changes: 17 additions & 0 deletions tools/dune
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,22 @@
(section lib)
(package ocaml))

(library
(name debug_printers)
(modes byte)
(libraries ocamlcommon)
(modules debug_printers))

(rule
(target debug_printers)
(deps debug_printers.ml %{cmo:debug_printers})
(action
(with-stdout-to %{target}
(progn
; Resorting to Bash instead of the built-in [echo] action because I
; couldn't find a better way to get an absolute path out of Dune
(bash "echo load_printer \\\"$(realpath %{cmo:debug_printers})\\\"")
(with-stdin-from debug_printers.ml
(run awk "{ print \"install_printer Debug_printers.\" $2 }"))))))

; ocamlcp, ocamloptp and ocamlprof are not currently supported.

0 comments on commit 1deb5af

Please sign in to comment.