Commit f55f8b7c authored by bguillaum's avatar bguillaum

move to ocamlbuild

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8892 7838e531-6607-4d57-9587-6c381814729c
parent d3bf0458
*.cmo
*.cmi
*.o
*.cmx
*.annot
*.a
*.cma
*.cmxa
# generated ml files
grew_parser.ml
grew_parser.mli
grew_lexer.ml
.depend
Makefile
confdefs.h
config.log
config.status
doc/*.pdf
doc/*.log
doc/*.aux
_build
*.sublime-*
name = "libgrew@DEV@"
name = "libgrew_dev"
description = "Libgrew"
version = "@VERSION@"
requires = ""
archive(byte) = "libgrew.cma"
archive(native) = "libgrew.cmxa"
name = "libgrew"
description = "Libgrew"
requires = ""
archive(byte) = "libgrew.cma"
archive(native) = "libgrew.cmxa"
OCB_FLAGS = -use-ocamlfind -use-menhir -I src
OCB = ocamlbuild $(OCB_FLAGS)
LIB_FILES = libgrew.cma libgrew.cmxa libgrew.a libgrew.cmi libgrew_types.cmi
INSTALL_FILES = $(LIB_FILES:%=_build/src/%)
VERSION = `cat VERSION`
build:
$(OCB) $(LIB_FILES)
install: build uninstall
cp META_STD META
ocamlfind install -patch-version $(VERSION) libgrew META $(INSTALL_FILES)
rm -f META
install_dev: build uninstall_dev
cp META_DEV META
ocamlfind install -patch-version $(VERSION) libgrew_dev META $(INSTALL_FILES)
rm -f META
uninstall:
ocamlfind remove libgrew
uninstall_dev:
ocamlfind remove libgrew_dev
doc:
$(OCB) libgrew.docdir/index.html
.PHONY: all clean build sanity
clean:
$(OCB) -clean
all:
@make -C src all
LIB_DEP = libgrew_types.cmi libgrew.cmi libgrew.cma libgrew.cmxa libgrew.a
uninstall:
$(OCAMLFIND) remove libgrew > /dev/null
uninstall_dev:
$(OCAMLFIND) remove libgrew_dev > /dev/null
install: uninstall
cp META META_
sed -itmp "s|@VERSION@|$(VERSION)|g" META
sed -itmp "s|@DEV@||g" META
rm -rf METAtmp
mkdir -p $(DESTDIR)$(DATA_DIR)/
cp data/style.css $(DESTDIR)$(DATA_DIR)/
cd src && $(OCAMLFIND) install libgrew ../META $(LIB_DEP)
mv META_ META
install_dev: uninstall_dev
cp META META_
sed -itmp "s|@VERSION@|$(VERSION)|g" META
sed -itmp "s|@DEV@|_dev|g" META
rm -rf METAtmp
cd src && $(OCAMLFIND) install libgrew_dev ../META $(LIB_DEP)
mv META_ META
cp data/style.css $(DESTDIR)$(DATA_DIR)/
conf: config/configure.ac
cd config && rm -rf ac_lib_checking.*
cd config && wget https://gforge.inria.fr/scm/viewvc.php/*checkout*/ac_lib_checking/ac_lib_checking.m4?root=semagramme --no-check-certificate || true
cd config && mv ac_lib_checking.m4?root=semagramme ac_lib_checking.m4 || true
cd config && aclocal
cd config && autoconf -o ../configure configure.ac
rm -rf config.status config.log autom4te.cache config/autom4te.cache config/ac_lib_checking.m4
clean:
@make -C src clean
rm -f config.log confdefs.h config.status
purge: clean
rm -f config/Makefile
rm -f config/ac_lib_checking.m4
rm -f Makefile src/Makefile test/Makefile
rm -rf doc
.PHONY: doc
doc:
@make -C src doc
include config/Makefile
true: package(xml-light dep2pict camomile, cairo2, log)
VERSION = 0.31.1
DATA_DIR = @prefix@@datarootdir@/libgrew/
DOC_DIR = @prefix@@datarootdir@/libgrew-doc/
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLLIB = @OCAMLLIB@
OCAMLFIND = @OCAMLFIND@
OCAMLLEX = @OCAMLLEX@
OCAMLDEP = @OCAMLDEP@
MENHIR = @MENHIR@
BYTE_FLAGS = -g -dtypes
OPT_FLAGS = -g -dtypes
DEBUG = @DEBUG@
WARNING = @WARNING@
MESSAGE = @MESSAGE@
INFO = @INFO@
LOG_DIR = @LOG_INCLUDE@
LOG_BYTE = $(LOG_DIR) log.cma
LOG_OPT = $(LOG_DIR) log.cmxa
XML_LIGHT_DIR = @XMLLIGHT_INCLUDE@
XML_LIGHT_BYTE = $(XML_LIGHT_DIR) xml-light.cma
XML_LIGHT_OPT = $(XML_LIGHT_DIR) xml-light.cmxa
ifeq (@DEP2PICT@,no)
DEP2PICT=no
else
DEP2PICT=yes
DEP2PICT_DIR = @DEP2PICT_INCLUDE@
DEP2PICT_BYTE = $(DEP2PICT_DIR) dep2pict.cma
DEP2PICT_OPT = $(DEP2PICT_DIR) dep2pict.cmxa
endif
ANSITERMINAL_DIR = @ANSITERMINAL_INCLUDE@
ANSITERMINAL_BYTE = $(ANSITERMINAL_DIR) ANSITerminal.cma
ANSITERMINAL_OPT = $(ANSITERMINAL_DIR) ANSITerminal.cmxa
infos:
@echo ""
@echo "VERSION -> " $(VERSION)
@echo ""
@echo "prefix -> " @prefix@
@echo "DATA_DIR -> " $(DATA_DIR)
@echo "DOC_DIR -> " $(DOC_DIR)
@echo ""
@echo "OCAMLC -> " $(OCAMLC)
@echo "OCAMLOPT -> " $(OCAMLOPT)
@echo "OCAMLLIB -> " $(OCAMLLIB)
@echo "OCAMLFIND -> " $(OCAMLFIND)
@echo "OCAMLDEP -> " $(OCAMLDEP)
@echo "MENHIR -> " $(MENHIR)
@echo "BYTE_FLAGS -> " $(BYTE_FLAGS)
@echo "OPT_FLAGS -> " $(OPT_FLAGS)
@echo ""
@echo "LOG_OPT -> " $(LOG_OPT)
@echo "DEP2PICT_OPT -> " $(DEP2PICT_OPT)
@echo "ANSITERMINAL_OPT -> " $(ANSITERMINAL_OPT)
@echo ""
@echo "DEBUG -> " $(DEBUG)
@echo "WARNING -> " $(WARNING)
@echo "MESSAGE -> " $(MESSAGE)
@echo "INFO -> " $(INFO)
@echo ""
@echo "use dep2pict -> " $(DEP2PICT)
AC_PREREQ([2.63])
AC_INIT(libcaml-grew, 1.0, bruno.guillaume@inria.fr)
AC_ARG_ENABLE(
[config],
[AS_HELP_STRING([--enable-config],[Enable configuration check (default is yes)])],
[config=$enableval],
[config=yes])
AC_ARG_ENABLE(
[dep2pict],
[AS_HELP_STRING([--enable-dep2pict],[Enable dep2pict (default is yes)])],
[dep2pict=$enableval],
[dep2pict=yes])
if test "$config" = yes ; then
# Checks for programs.
AC_CHECK_PROGS(OCAMLC,ocamlc.opt ocamlc,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc)
fi
AC_SUBST(OCAMLC)
AC_CHECK_PROGS(OCAMLOPT,ocamlopt.opt ocamlopt,no)
if test "$OCAMLOPT" = no ; then
AC_MSG_ERROR(Cannot find ocamlopt)
fi
AC_SUBST(OCAMLOPT)
AC_CHECK_PROGS(OCAMLLEX,ocamllex.opt ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex)
fi
AC_SUBST(OCAMLLEX)
AC_PATH_PROG(OCAMLDEP,ocamldep.opt ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep)
fi
AC_SUBST(OCAMLDEP)
# Checks for libraries.
AC_MSG_CHECKING(for ocaml library path)
OCAMLLIB=$($OCAMLC -where)
AC_MSG_RESULT($OCAMLLIB)
if test "$OCAMLLIB" = ""; then
AC_MSG_ERROR(Cannot find ocaml library path)
fi
AC_SUBST(OCAMLLIB)
# Look for ocamlfind
AC_PATH_PROG(OCAMLFIND,ocamlfind,no)
if test "$OCAMLFIND" = no ; then
AC_MSG_ERROR(Cannot find ocamlfind)
fi
AC_SUBST(OCAMLFIND)
AC_PATH_PROG(MENHIR,menhir,no)
if test "$MENHIR" = "no"; then
AC_MSG_ERROR(Cannot find menhir)
fi
AC_SUBST(MENHIR)
m4_include(ac_lib_checking.m4)
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"",true)
AC_SUBST(ANSITERMINAL_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Log,log,log,log,Log,"",true)
AC_SUBST(LOG_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Xml-light,xml-light,xml-light,xml-light,XmlParser,"",true,true)
AC_SUBST(XMLLIGHT_INCLUDE,$LIB_INCLUDE)
# Dep2pict is optionnal
AC_LIB_CHECKING(Dep2pict,dep2pict,dep2pict,dep2pict,Dep2pict,"",false,true)
if test "$dep2pict" = no; then
AC_SUBST(DEP2PICT,no)
else
AC_SUBST(DEP2PICT,yes)
AC_SUBST(DEP2PICT_INCLUDE,$LIB_INCLUDE)
fi
fi
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [Display debug trace])],
[with_debug=$enableval],
[with_debug=no])
AC_ARG_ENABLE(
[warning],
[AS_HELP_STRING([--enable-warning], [Display warning trace])],
[with_warning=$enableval],
[with_warning=no])
AC_ARG_ENABLE(
[message],
[AS_HELP_STRING([--enable-message], [Display message trace])],
[with_message=$enableval],
[with_message=yes])
AC_ARG_ENABLE(
[info],
[AS_HELP_STRING([--enable-info], [Display info trace])],
[with_info=$enableval],
[with_info=yes])
if test "x$with_debug" != xno ; then
AC_SUBST(DEBUG,yes)
else
AC_SUBST(DEBUG,no)
fi
if test "x$with_warning" != xno ; then
AC_SUBST(WARNING,yes)
else
AC_SUBST(WARNING,no)
fi
if test "x$with_message" != xno ; then
AC_SUBST(MESSAGE,yes)
else
AC_SUBST(MESSAGE,no)
fi
if test "x$with_info" != xno ; then
AC_SUBST(INFO,yes)
else
AC_SUBST(INFO,no)
fi
#trunk directory
TRUNK=`pwd`
AC_SUBST(TRUNK)
AC_SUBST(ANSITERMINAL_INCLUDE)
AC_SUBST(LOG_INCLUDE)
AC_SUBST(DEP2PICT_INCLUDE)
echo ""
AC_SUBST(SET_MAKE)
AC_CONFIG_FILES(\
config/Makefile \
Makefile \
src/Makefile \
)
AC_PROG_MAKE_SET
echo ""
echo "Creating Makefiles"
echo ""
AC_OUTPUT
echo ""
echo "Some information"
echo ""
cd config && make infos
echo ""
This source diff could not be displayed because it is too large. You can view the blob instead.
open Ocamlbuild_plugin
let get_version () =
let in_ch = open_in "VERSION" in
let v = input_line in_ch in
close_in in_ch;
v
let () =
dispatch begin function
| After_rules ->
let v = get_version () in
let pp_src = S[A"-pp"; A("camlp4o pa_macro.cmo -DVERSION=\\\""^v^"\\\" -DDEP2PICT")] in
flag ["ocaml"; "ocamldep"] & pp_src;
flag ["ocaml"; "compile"] & pp_src;
| _ -> ()
end
opam-version: "1.2"
maintainer: "Bruno.Guillaume@loria.fr"
homepage: "htpp://dep2pict.loria.fr"
build: [
["make"]
]
install: [
["make" "install"]
]
remove: [
["make" "uninstall"]
]
depends: [
"ANSITerminal"
"xml-light"
"libcaml-log"
"cairo2"
"menhir"
"camomile"
"libcaml-dep2pict"
]
opam-version: "1"
maintainer: "Bruno.Guillaume@loria.fr"
build: [
["./configure" "--prefix" prefix]
["make"]
["make" "install"]
]
depends: ["ANSITerminal" "xml-light" "libcaml-log" "menhir" "libcaml-dep2pict"]
......@@ -429,7 +429,7 @@ module Html_doc = struct
let ast = Grs.get_ast grs in
ignore(Sys.command ("rm -rf "^output_dir));
ignore(Sys.command ("mkdir "^output_dir));
ignore(Sys.command ("cp "^DATA_DIR^"/style.css "^output_dir));
(* ignore(Sys.command ("cp "^DATA_DIR^"/style.css "^output_dir)); *)
(** index.html **)
let index = Filename.concat output_dir "index.html" in
......@@ -915,7 +915,7 @@ module Corpus_stat = struct
let ratio nb = (float nb) /. (float t.num) *. 100. in
(* put the css file the [output_dir] *)
ignore(Sys.command("cp "^(Filename.concat DATA_DIR "style.css")^" "^(Filename.concat output_dir "style.css")));
(* ignore(Sys.command("cp "^(Filename.concat DATA_DIR "style.css")^" "^(Filename.concat output_dir "style.css"))); *)
let buff = Buffer.create 32 in
let wnl fmt = Printf.ksprintf (fun x -> Printf.bprintf buff "%s\n" x) fmt in
......
......@@ -159,7 +159,7 @@ and standard target = parse
| '\n' { incr Global.current_line; Lexing.new_line lexbuf; global lexbuf}
| "include" { INCLUDE }
| "include" { INCL }
| "features" { FEATURES }
| "feature" { FEATURE }
| "file" { FILE }
......
......@@ -62,7 +62,7 @@ let localize t = (t,get_loc ())
%token ARROW_LEFT_NEG /* =[^ */
%token ARROW_RIGHT /* ]=> */
%token INCLUDE /* include */
%token INCL /* include */
%token FEATURES /* features */
%token FEATURE /* feature */
%token FILE /* file */
......@@ -230,7 +230,7 @@ module_or_include_list:
module_or_include:
| m=grew_module { Ast.Modul m }
| INCLUDE sub=subfile SEMIC { Ast.Includ sub }
| INCL sub=subfile SEMIC { Ast.Includ sub }
subfile:
| f=STRING { localize f }
......
......@@ -86,8 +86,8 @@ module Instance = struct
Dep2pict.highlight_shift ()
ELSE
let save_dep_png ?filter ?main_feat base t = None
let save_dep_svg ?filter ?main_feat base t = None
let save_dep_png _ ?filter ?main_feat base t = None
let save_dep_svg _ ?filter ?main_feat base t = None
ENDIF
end (* module Instance *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment