summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rw-r--r--descr2
-rw-r--r--opam34
-rw-r--r--src/Makefile13
-rw-r--r--src/ocaml_backend.ml6
-rw-r--r--src/process_file.ml8
6 files changed, 57 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 71a08f64..a0b6c81f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
.PHONY: all sail language clean archs isabelle-lib apply_header
INSTALL_DIR ?= .
+SHARE_DIR ?= $(INSTALL_DIR)
all: sail
@@ -15,15 +16,15 @@ isail:
install:
mkdir -p $(INSTALL_DIR)/bin
cp src/isail.native $(INSTALL_DIR)/bin/sail
- mkdir -p $(INSTALL_DIR)/share/sail
- cp -r lib $(INSTALL_DIR)/share/sail
- mkdir -p $(INSTALL_DIR)/share/sail/src
- cp src/elf_loader.ml $(INSTALL_DIR)/share/sail/src
- cp src/sail_lib.ml $(INSTALL_DIR)/share/sail/src
+ mkdir -p $(SHARE_DIR)
+ cp -r lib $(SHARE_DIR)
+ mkdir -p $(SHARE_DIR)/src
+ cp src/elf_loader.ml $(SHARE_DIR)/src
+ cp src/sail_lib.ml $(SHARE_DIR)/src
uninstall:
rm -f $(INSTALL_DIR)/bin/sail
- rm -rf $(INSTALL_DIR)/share/sail
+ rm -rf $(SHARE_DIR)
language:
$(MAKE) -C language
diff --git a/descr b/descr
new file mode 100644
index 00000000..d868bc3a
--- /dev/null
+++ b/descr
@@ -0,0 +1,2 @@
+Sail is a language for describing the instruction semantics of processors.
+It has been used in several papers, available from http://www.cl.cam.ac.uk/~pes20/sail/. \ No newline at end of file
diff --git a/opam b/opam
new file mode 100644
index 00000000..04722afd
--- /dev/null
+++ b/opam
@@ -0,0 +1,34 @@
+opam-version: "1.2"
+name: "sail"
+version: "0.1"
+maintainer: "Sail Devs <cl-sail-dev@lists.cam.ac.uk>"
+authors: [
+ "Alasdair Armstrong"
+ "Thomas Bauereiss"
+ "Brian Campbell"
+ "Shaked Flur"
+ "Jonathan French"
+ "Kathy Gray"
+ "Robert Norton"
+ "Christopher Pulte"
+ "Peter Sewell"
+ "Mark Wassell"
+]
+homepage: "http://www.cl.cam.ac.uk/~pes20/sail/"
+bug-reports: "https://github.com/rems-project/sail/issues"
+license: "BSD3"
+dev-repo: "https://github.com/rems-project/sail"
+build: [make "INSTALL_DIR=%{prefix}%" "SHARE_DIR=%{sail:share}%" "isail"]
+install: [make "INSTALL_DIR=%{prefix}%" "SHARE_DIR=%{sail:share}%" "install"]
+remove: [make "INSTALL_DIR=%{prefix}%" "SHARE_DIR=%{sail:share}%" "uninstall"]
+depends: [
+ "ocamlfind"
+ "ocamlbuild"
+ "zarith"
+ "menhir"
+ "linenoise"
+ "ott" {>= "0.28"}
+ "lem"
+ "linksem"
+]
+available: [ocaml-version >= "4.02.3"]
diff --git a/src/Makefile b/src/Makefile
index d71fb20b..97b87d4b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -67,7 +67,7 @@ endif
# set to -p on command line to enable gprof profiling
OCAML_OPTS?=
-INSTALL_DIR?=$(realpath ..)
+SHARE_DIR?=$(realpath ..)
all: sail lib doc
@@ -90,14 +90,14 @@ bytecode.ml: bytecode.lem
lem_interp/interp_ast.lem: ../language/l2.ott
ott -sort false -generate_aux_rules true -o lem_interp/interp_ast.lem -picky_multiple_parses true ../language/l2.ott
-install_directory.ml:
- echo "(* Generated file -- do not edit. *)" > install_directory.ml
- echo let d=\"$(INSTALL_DIR)\" >> install_directory.ml
+share_directory.ml:
+ echo "(* Generated file -- do not edit. *)" > share_directory.ml
+ echo let d=\"$(SHARE_DIR)\" >> share_directory.ml
-sail: ast.ml bytecode.ml install_directory.ml
+sail: ast.ml bytecode.ml share_directory.ml
ocamlbuild -use-ocamlfind sail.native sail_lib.cma sail_lib.cmxa
-isail: ast.ml bytecode.ml install_directory.ml
+isail: ast.ml bytecode.ml share_directory.ml
ocamlbuild -use-ocamlfind isail.native
sail.native: sail
@@ -148,6 +148,7 @@ clean:
-rm -f bytecode.ml
-rm -f bytecode.lem
-rm -f bytecode.ml.bak
+ -rm -f share_directory.ml
doc:
ocamlbuild -use-ocamlfind sail.docdir/index.html
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml
index 91ca17b6..00a6c4c3 100644
--- a/src/ocaml_backend.ml
+++ b/src/ocaml_backend.ml
@@ -686,11 +686,11 @@ let ocaml_compile spec defs =
let sail_dir =
try Sys.getenv "SAIL_DIR" with
| Not_found ->
- let share_dir = Filename.concat Install_directory.d "share/sail" in
- if Sys.is_directory share_dir then
+ let share_dir = Share_directory.d in
+ if Sys.file_exists share_dir then
share_dir
else
- failwith "Could not find sail share directory, " ^ share_dir ^ ". Make sail is installed or try setting environment variable SAIL_DIR."
+ failwith "Could not find sail share directory, " ^ share_dir ^ ". Make sure sail is installed or try setting environment variable SAIL_DIR."
in
if Sys.file_exists "_sbuild" then () else Unix.mkdir "_sbuild" 0o775;
let cwd = Unix.getcwd () in
diff --git a/src/process_file.ml b/src/process_file.ml
index dd34f49c..a576c16e 100644
--- a/src/process_file.ml
+++ b/src/process_file.ml
@@ -150,11 +150,11 @@ let rec preprocess = function
let sail_dir =
try Sys.getenv "SAIL_DIR" with
| Not_found ->
- let lib_dir = Filename.concat Install_directory.d "lib" in
- if Sys.is_directory lib_dir then
- Install_directory.d
+ let share_dir = Share_directory.d in
+ if Sys.file_exists share_dir then
+ share_dir
else
- (failwith ("Library directory " ^ lib_dir ^ " does not exist. Make sure sail is installed or try setting environment variable SAIL_DIR so that I can find $include " ^ file))
+ (failwith ("Library directory " ^ share_dir ^ " does not exist. Make sure sail is installed or try setting environment variable SAIL_DIR so that I can find $include " ^ file))
in
let file = Filename.concat sail_dir ("lib/" ^ file) in
let (Parse_ast.Defs include_defs) = parse_file file in