Skip to content
Snippets Groups Projects
Commit 147008d3 authored by François Bobot's avatar François Bobot
Browse files

Use load_script facilities of dune

  - remove the last use of ocamlfind
parent f39dd28d
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ MAJOR_VERSION=$(shell $(SED) -E 's/^([0-9]+)\..*/\1/' VERSION) ...@@ -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) MINOR_VERSION=$(shell $(SED) -E 's/^[0-9]+\.([0-9]+).*/\1/' VERSION)
VERSION_CODENAME=$(shell $(CAT) VERSION_CODENAME) 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 "# generated file" > $@
@echo "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" >> $@ @echo "s|@VERSION_CODENAME@|$(VERSION_CODENAME)|" >> $@
@echo "s|@VERSION@|$(VERSION)|" >> $@ @echo "s|@VERSION@|$(VERSION)|" >> $@
......
...@@ -87,7 +87,7 @@ ifeq ($(DEVELOPMENT),yes) ...@@ -87,7 +87,7 @@ ifeq ($(DEVELOPMENT),yes)
# - 67 (unused module parameter in functor signature): naming all parameters # - 67 (unused module parameter in functor signature): naming all parameters
# in functor signatures is a common practice that seems harmless. Warning 60 # in functor signatures is a common practice that seems harmless. Warning 60
# ensures that named functor parameters are indeed used in the implementation. # 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 # - 3 (deprecated feature) cannot always be avoided for OCaml stdlib when
# supporting several OCaml versions # supporting several OCaml versions
...@@ -105,7 +105,7 @@ WARN_ERROR ?= -warn-error +a-3-4-32-33-34-35-36-37-38-39-58 ...@@ -105,7 +105,7 @@ WARN_ERROR ?= -warn-error +a-3-4-32-33-34-35-36-37-38-39-58
else else
WARNINGS ?= -w -a WARNINGS ?= -a
endif #DEVELOPMENT endif #DEVELOPMENT
......
...@@ -131,36 +131,17 @@ let load_packages pkgs = ...@@ -131,36 +131,17 @@ let load_packages pkgs =
let load_script base = let load_script base =
Klog.feedback ~dkey "compiling script '%s.ml'" base ; Klog.feedback ~dkey "compiling script '%s.ml'" base ;
let cmd = Buffer.create 80 in let result, stdout, stderr =
let fmt = Format.formatter_of_buffer cmd in Dune_site_plugins.V1.load_script
begin ~open_:["Frama_c_kernel"]
if Dynlink.is_native then ~warnings:Fc_config.ocaml_wflags
Format.fprintf fmt "ocamlfind ocamlopt -shared -o %S.cmxs" base (base^".ml")
else in
Format.fprintf fmt "ocamlfind ocamlc -c"; List.iter (Format.printf "%s") stdout;
Format.fprintf fmt " -package frama-c.kernel -open Frama_c_kernel -g %s -warn-error a" Fc_config.ocaml_wflags ; List.iter (Format.eprintf "%s") stderr;
if Fc_config.is_gui then Format.pp_print_string fmt " -package lablgtk2" ; match result with
Format.fprintf fmt " %s.ml" base ; | `Ok -> ()
Format.pp_print_flush fmt () ; | `Compilation_failed -> Klog.error "compilation of '%s.ml' failed" base
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
(* -------------------------------------------------------------------------- *) (* -------------------------------------------------------------------------- *)
(* --- Command-Line Entry Points --- *) (* --- Command-Line Entry Points --- *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment