parent
81ad14ab7b
commit
f4aafa10d6
@ -0,0 +1,13 @@
|
|||||||
|
.PHONY: all install
|
||||||
|
|
||||||
|
all:
|
||||||
|
(cd compiler/; $(MAKE))
|
||||||
|
(cd lib; $(MAKE))
|
||||||
|
|
||||||
|
install:
|
||||||
|
(cd compiler; $(MAKE) install)
|
||||||
|
(cd lib; $(MAKE) install)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
(cd compiler; $(MAKE) clean)
|
||||||
|
(cd lib; $(MAKE) clean)
|
@ -0,0 +1,14 @@
|
|||||||
|
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||||
|
|
||||||
|
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||||
|
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||||
|
# This file is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
m4_include([m4/ocaml.m4])
|
@ -1,24 +1,49 @@
|
|||||||
|
include ../config
|
||||||
|
|
||||||
BUILD:= _build
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
OCAMLBUILD:=ocamlbuild
|
BIN:=heptc.$(TARGET) hepts.$(TARGET)
|
||||||
COMPILER:=heptc
|
else
|
||||||
|
BIN:=heptc.$(TARGET)
|
||||||
|
endif
|
||||||
|
|
||||||
TARGET:=byte
|
.PHONY: all clean opt byte clean debug install
|
||||||
|
|
||||||
.PHONY: all opt byte debug profile clean
|
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
opt:
|
opt:
|
||||||
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
|
$(OCAMLBUILD) $(COMPILER).native $(SIMULATOR).native
|
||||||
|
else
|
||||||
$(OCAMLBUILD) $(COMPILER).native
|
$(OCAMLBUILD) $(COMPILER).native
|
||||||
|
endif
|
||||||
|
|
||||||
byte:
|
byte:
|
||||||
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
|
$(OCAMLBUILD) $(COMPILER).byte $(SIMULATOR).byte
|
||||||
|
else
|
||||||
$(OCAMLBUILD) $(COMPILER).byte
|
$(OCAMLBUILD) $(COMPILER).byte
|
||||||
|
endif
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
|
$(OCAMLBUILD) $(COMPILER).d.byte $(SIMULATOR).d.byte
|
||||||
|
else
|
||||||
$(OCAMLBUILD) $(COMPILER).d.byte
|
$(OCAMLBUILD) $(COMPILER).d.byte
|
||||||
|
endif
|
||||||
|
|
||||||
profile:
|
profile:
|
||||||
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
|
$(OCAMLBUILD) $(COMPILER).p.native $(SIMULATOR).p.native
|
||||||
|
else
|
||||||
$(OCAMLBUILD) $(COMPILER).p.native
|
$(OCAMLBUILD) $(COMPILER).p.native
|
||||||
|
endif
|
||||||
|
|
||||||
|
install: all
|
||||||
|
$(INSTALL) -d $(INSTALL_BINDIR)
|
||||||
|
$(INSTALL) $(COMPILER).$(TARGET) $(INSTALL_BINDIR)/$(COMPILER)
|
||||||
|
ifeq ($(ENABLE_SIMULATOR), yes)
|
||||||
|
$(INSTALL) $(COMPILER).$(TARGET) $(INSTALL_BINDIR)/$(SIMULATOR)
|
||||||
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(OCAMLBUILD).native -clean
|
$(OCAMLBUILD) -clean
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<global> or <utilities> or <minils> or <heptagon> or <main> or <obc>:include
|
<global> or <utilities> or <minils> or <heptagon> or <main> or <obc>:include
|
||||||
<**/*.ml>: debug, dtypes
|
<**/*.ml>: debug, dtypes, pkg_ocamlgraph
|
||||||
<preproc.ml>: camlp4of, use_camlp4
|
<preproc.ml>: camlp4of, use_camlp4
|
||||||
<**/hept_parser.ml>: use_menhirLib
|
true:use_menhir
|
||||||
<**/mls_parser.ml>: use_menhirLib
|
<**/*.{byte,native}>: use_unix, use_str, debug, pkg_menhirLib, pkg_ocamlgraph
|
||||||
<**/*.{byte,native}>: use_unix, use_str, link_menhirLib, link_graph, debug
|
|
||||||
true: use_menhir, use_graph
|
|
||||||
|
|
||||||
<main/hepts.ml>: use_lablgtk, thread
|
<main/hepts.ml>: pkg_lablgtk2, thread
|
||||||
<main/hepts.{byte,native}>: use_lablgtk, use_lablgtkthread, thread
|
<main/hepts.{byte,native}>: pkg_lablgtk2, thread
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
<hept_parser.ml>: pkg_menhirLib
|
@ -0,0 +1,80 @@
|
|||||||
|
open Ocamlbuild_plugin
|
||||||
|
|
||||||
|
(* these functions are not really officially exported *)
|
||||||
|
let run_and_read = Ocamlbuild_pack.My_unix.run_and_read
|
||||||
|
let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings
|
||||||
|
|
||||||
|
let split s ch =
|
||||||
|
let x = ref [] in
|
||||||
|
let rec go s =
|
||||||
|
let pos = String.index s ch in
|
||||||
|
x := (String.before s pos)::!x;
|
||||||
|
go (String.after s (pos + 1))
|
||||||
|
in
|
||||||
|
try
|
||||||
|
go s
|
||||||
|
with Not_found -> !x
|
||||||
|
|
||||||
|
let split_nl s = split s '\n'
|
||||||
|
|
||||||
|
let before_space s =
|
||||||
|
try
|
||||||
|
String.before s (String.index s ' ')
|
||||||
|
with Not_found -> s
|
||||||
|
|
||||||
|
(* this lists all supported packages *)
|
||||||
|
let find_packages () =
|
||||||
|
List.map before_space (split_nl & run_and_read "ocamlfind list")
|
||||||
|
|
||||||
|
(* this is supposed to list available syntaxes, but I don't know how to do it. *)
|
||||||
|
let find_syntaxes () = ["camlp4o"; "camlp4r"]
|
||||||
|
|
||||||
|
(* ocamlfind command *)
|
||||||
|
let ocamlfind x = S[A"ocamlfind"; x]
|
||||||
|
|
||||||
|
let ocamlfind_before_options () =
|
||||||
|
(* by using Before_options one let command line options have an higher priority *)
|
||||||
|
(* on the contrary using After_options will guarantee to have the higher priority *)
|
||||||
|
|
||||||
|
(* override default commands by ocamlfind ones *)
|
||||||
|
Options.ocamlc := ocamlfind & A"ocamlc";
|
||||||
|
Options.ocamlopt := ocamlfind & A"ocamlopt";
|
||||||
|
Options.ocamldep := ocamlfind & A"ocamldep";
|
||||||
|
Options.ocamldoc := ocamlfind & A"ocamldoc";
|
||||||
|
Options.ocamlmktop := ocamlfind & A"ocamlmktop"
|
||||||
|
|
||||||
|
let ocamlfind_after_rules () =
|
||||||
|
(* When one link an OCaml library/binary/package, one should use -linkpkg *)
|
||||||
|
flag ["ocaml"; "link"; "program"] & A"-linkpkg";
|
||||||
|
|
||||||
|
(* For each ocamlfind package one inject the -package option when
|
||||||
|
* compiling, computing dependencies, generating documentation and
|
||||||
|
* linking. *)
|
||||||
|
List.iter begin fun pkg ->
|
||||||
|
flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg];
|
||||||
|
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg];
|
||||||
|
flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg];
|
||||||
|
flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg];
|
||||||
|
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
|
||||||
|
end (find_packages ());
|
||||||
|
|
||||||
|
(* Like -package but for extensions syntax. Morover -syntax is useless
|
||||||
|
* when linking. *)
|
||||||
|
List.iter begin fun syntax ->
|
||||||
|
flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
|
||||||
|
flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
|
||||||
|
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
|
||||||
|
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
|
||||||
|
end (find_syntaxes ());
|
||||||
|
|
||||||
|
(* The default "thread" tag is not compatible with ocamlfind.
|
||||||
|
Indeed, the default rules add the "threads.cma" or "threads.cmxa"
|
||||||
|
options when using this tag. When using the "-linkpkg" option with
|
||||||
|
ocamlfind, this module will then be added twice on the command line.
|
||||||
|
|
||||||
|
To solve this, one approach is to add the "-thread" option when using
|
||||||
|
the "threads" package using the previous plugin.
|
||||||
|
*)
|
||||||
|
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
|
||||||
|
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
|
||||||
|
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
|
@ -0,0 +1,22 @@
|
|||||||
|
srcdir = .
|
||||||
|
top_srcdir = .
|
||||||
|
prefix = /opt/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
bindir = ${exec_prefix}/bin
|
||||||
|
libdir = ${exec_prefix}/lib
|
||||||
|
|
||||||
|
INSTALL= /usr/bin/install -c
|
||||||
|
MAKE= @MAKE@
|
||||||
|
|
||||||
|
BUILD= _build
|
||||||
|
COMPILER=heptc
|
||||||
|
SIMULATOR=hepts
|
||||||
|
|
||||||
|
INSTALL_BINDIR=$(bindir)
|
||||||
|
INSTALL_LIBDIR=$(libdir)/heptagon
|
||||||
|
STDLIB_DIR=${exec_prefix}/lib/heptagon
|
||||||
|
|
||||||
|
OCAMLBUILD=STDLIB=$(STDLIB_DIR) ocamlbuild
|
||||||
|
|
||||||
|
TARGET=byte
|
||||||
|
ENABLE_SIMULATOR=yes
|
@ -0,0 +1,22 @@
|
|||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
|
||||||
|
INSTALL= @INSTALL@
|
||||||
|
MAKE= @MAKE@
|
||||||
|
|
||||||
|
BUILD= _build
|
||||||
|
COMPILER=heptc
|
||||||
|
SIMULATOR=hepts
|
||||||
|
|
||||||
|
INSTALL_BINDIR=$(bindir)
|
||||||
|
INSTALL_LIBDIR=$(libdir)/heptagon
|
||||||
|
STDLIB_DIR=@stdlib_dir@
|
||||||
|
|
||||||
|
OCAMLBUILD=STDLIB=$(STDLIB_DIR) @OCAMLBUILD@
|
||||||
|
|
||||||
|
TARGET=byte
|
||||||
|
ENABLE_SIMULATOR=@enable_simulator@
|
@ -0,0 +1,60 @@
|
|||||||
|
AC_INIT(heptagon,1.0)
|
||||||
|
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(simulator,
|
||||||
|
[ --enable-simulator enable Why3 IDE],,
|
||||||
|
enable_simulator=no)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(local_stdlib,
|
||||||
|
[ --enable-local-stdlib Use the standard library in the source tree],,
|
||||||
|
enable_local_stdlib=no)
|
||||||
|
|
||||||
|
AC_PROG_OCAML
|
||||||
|
if test "$OCAMLC" = "no"; then
|
||||||
|
AC_MSG_ERROR([Please install the OCaml compiler])
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$OCAMLVERSION" in
|
||||||
|
0.*|1.*|2.*|3.0*)
|
||||||
|
AC_MSG_ERROR(You need Objective Caml 3.10 or higher);;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AC_PROG_FINDLIB
|
||||||
|
if test "$OCAMLFIND" = "no"; then
|
||||||
|
AC_MSG_ERROR([Please install OCaml findlib (the ocamlfind command)])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_PROG(MENHIR,menhir,menhir,no)
|
||||||
|
if test "$MENHIR" = no ; then
|
||||||
|
AC_MSG_ERROR(Please install menhir.)
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_OCAML_PKG([menhirLib])
|
||||||
|
if test "$OCAML_PKG_menhirLib" = "no"; then
|
||||||
|
AC_MSG_ERROR([Please install menhirLib package.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_OCAML_PKG([ocamlgraph])
|
||||||
|
if test "$OCAML_PKG_ocamlgraph" = "no"; then
|
||||||
|
AC_MSG_ERROR([Please install ocamlgraph package.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_OCAML_PKG([lablgtk2])
|
||||||
|
if test "$OCAML_PKG_lablgtk2" = "no"; then
|
||||||
|
enable_simulator=no
|
||||||
|
AC_MSG_WARN([Could not find 'lablgtk2'. The simulator will not be built])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$enable_local_stdlib" = "yes"; then
|
||||||
|
stdlib_dir=$srcdir/lib
|
||||||
|
else
|
||||||
|
stdlib_dir=$libdir/heptagon
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(INSTALL)
|
||||||
|
AC_SUBST(stdlib_dir)
|
||||||
|
|
||||||
|
AC_SUBST(enable_simulator)
|
||||||
|
|
||||||
|
AC_OUTPUT(config)
|
Loading…
Reference in New Issue