diff --git a/Makefile b/Makefile index 310df6be813458feab212edff6ca70b2114d9021..7ad4104645e3da7f9b68758970ef814b794f04e6 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ MAJOR_VERSION=$(shell $(SED) -E 's/^([0-9]+)\..*/\1/' VERSION) MINOR_VERSION=$(shell $(SED) -E 's/^[0-9]+\.([0-9]+).*/\1/' VERSION) VERSION_CODENAME=$(shell $(CAT) VERSION_CODENAME) -config.sed: VERSION share/Makefile.config Makefile configure.in +config.sed: VERSION share/Makefile.config share/Makefile.common Makefile configure.in @echo "# generated file" > $@ @echo "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" >> $@ @echo "s|@VERSION@|$(VERSION)|" >> $@ diff --git a/share/Makefile.common b/share/Makefile.common index affc77563611993266375cc54d2dfdfb7d31ba4e..d62520b26de85f9a2d47080473fbeabdfd5f5bef 100644 --- a/share/Makefile.common +++ b/share/Makefile.common @@ -87,7 +87,7 @@ ifeq ($(DEVELOPMENT),yes) # - 67 (unused module parameter in functor signature): naming all parameters # in functor signatures is a common practice that seems harmless. Warning 60 # ensures that named functor parameters are indeed used in the implementation. -WARNINGS ?= -w +a-4-6-9-40-41-42-44-45-48-50-67 +WARNINGS ?= +a-4-6-9-40-41-42-44-45-48-50-67 # - 3 (deprecated feature) cannot always be avoided for OCaml stdlib when # supporting several OCaml versions @@ -105,7 +105,7 @@ WARN_ERROR ?= -warn-error +a-3-4-32-33-34-35-36-37-38-39-58 else -WARNINGS ?= -w -a +WARNINGS ?= -a endif #DEVELOPMENT diff --git a/src/kernel_services/plugin_entry_points/dynamic.ml b/src/kernel_services/plugin_entry_points/dynamic.ml index 24b0a8fd54607c725024d38874e17f66e716383f..f80c8c44d9fb7c5a4a37c73586d88f7b74a00df1 100644 --- a/src/kernel_services/plugin_entry_points/dynamic.ml +++ b/src/kernel_services/plugin_entry_points/dynamic.ml @@ -131,36 +131,17 @@ let load_packages pkgs = let load_script base = Klog.feedback ~dkey "compiling script '%s.ml'" base ; - let cmd = Buffer.create 80 in - let fmt = Format.formatter_of_buffer cmd in - begin - if Dynlink.is_native then - Format.fprintf fmt "ocamlfind ocamlopt -shared -o %S.cmxs" base - else - Format.fprintf fmt "ocamlfind ocamlc -c"; - Format.fprintf fmt " -package frama-c.kernel -open Frama_c_kernel -g %s -warn-error a" Fc_config.ocaml_wflags ; - if Fc_config.is_gui then Format.pp_print_string fmt " -package lablgtk2" ; - Format.fprintf fmt " %s.ml" base ; - Format.pp_print_flush fmt () ; - let cmd = Buffer.contents cmd in - Klog.feedback ~dkey "running '%s'" cmd ; - begin - let res = Sys.command cmd in - if res <> 0 - then Klog.error "compilation of '%s.ml' failed" base - else - let pkg = Filename.basename base in - if Dynlink.is_native then - dynlib_module pkg (base ^ ".cmxs") - else - dynlib_module pkg (base ^ ".cmo") ; - end ; - let erase = Printf.sprintf "rm -f %s.cm* %s.o" base base in - Klog.feedback ~dkey "running '%s'" erase ; - let st = Sys.command erase in - if st <> 0 then - Klog.warning "Error when cleaning '%s.[o|cm*]' files" base ; - end + let result, stdout, stderr = + Dune_site_plugins.V1.load_script + ~open_:["Frama_c_kernel"] + ~warnings:Fc_config.ocaml_wflags + (base^".ml") + in + List.iter (Format.printf "%s") stdout; + List.iter (Format.eprintf "%s") stderr; + match result with + | `Ok -> () + | `Compilation_failed -> Klog.error "compilation of '%s.ml' failed" base (* -------------------------------------------------------------------------- *) (* --- Command-Line Entry Points --- *)