Commit d639ae35 authored by bguillaum's avatar bguillaum

version 0.26: switch to libcaml-conll

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/grew/trunk@8909 7838e531-6607-4d57-9587-6c381814729c
parent 0d2510a1
PREFIX?=/usr/local
BINDIR=$(PREFIX)/bin
DATA_DIR=$(PREFIX)/share/grew/
OCB_FLAGS = -use-ocamlfind -I src
OCB = ocamlbuild $(OCB_FLAGS)
VERSION = `cat VERSION`
all: native
native: src/grew_glade.ml datadir
$(OCB) -tag-line "true: package(libgrew)" grew_main.native
datadir:
echo $(DATA_DIR) > DATA_DIR
install:
cp grew_main.native $(BINDIR)/grew
mkdir -p $(DATA_DIR)
cp src/grew.glade $(DATA_DIR)
uninstall:
rm -f $(BINDIR)/grew
rm -f $(DATA_DIR)/grew.glade
.PHONY: all clean byte native install uninstall
clean:
$(OCB) -clean
rm -f DATA_DIR
rm -f src/grew_glade.ml
info:
@echo "BINDIR = $(BINDIR)"
@echo "DATA_DIR = $(DATA_DIR)"
# glade file are not handle by ocamlbuild
src/grew_glade.ml : src/grew.glade
lablgladecc2 $< > $@
sed -iback 's|src/grew.glade|$(DATA_DIR)grew.glade|g' src/grew_glade.ml
rm -f src/grew_glade.mlback
all:
@make -C src grew
include config/Makefile
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
conf2 : config/configure.ac
cd config && aclocal
cd config && autoconf -o ../configure configure.ac
rm -rf config.status config.log autom4te.cache config/autom4te.cache
clean: cleanup
@make -C config cleanup
@make -C src clean
install:
mkdir -p $(DESTDIR)$(INSTALL_DIR)
mkdir -p $(DESTDIR)$(DATA_DIR)
ifeq (@DEV@,yes)
cp src/grew $(DESTDIR)$(INSTALL_DIR)/grew_dev
else
cp src/grew $(DESTDIR)$(INSTALL_DIR)
endif
cp src/grew.glade $(DESTDIR)$(DATA_DIR)
purge_makefile:
@make -C src purge
@make -C config purge
rm -f config/ac_lib_checking.m4
rm -rf Makefile
true: package(str, ANSITerminal, camomile, cairo2, log, conll, dep2pict, lablgtk2, lablgtk2.rsvg, lablgtk2.glade, lablwebkit)
VERSION = 0.25
INSTALL_DIR = @prefix@@bindir@
DATA_DIR = @prefix@@datarootdir@/grew/
DOC_DIR = @docdir@grew/
BYTE_FLAGS = -g -dtypes
OPT_FLAGS =
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLLIB = @OCAMLLIB@
OCAMLFIND = @OCAMLFIND@
ANSITERMINAL_DIR = @ANSITERMINAL_INCLUDE@
ANSITERMINAL_BYTE = $(ANSITERMINAL_DIR) ANSITerminal.cma
ANSITERMINAL_OPT = $(ANSITERMINAL_DIR) ANSITerminal.cmxa
LOG_DIR = @LOG_INCLUDE@
LOG_BYTE = $(LOG_DIR) log.cma
LOG_OPT = $(LOG_DIR) log.cmxa
ITEXT_DIR = @ITEXT_INCLUDE@
ITEXT_BYTE = $(ITEXT_DIR) itext.cma
ITEXT_OPT = $(ITEXT_DIR) itext.cmxa
LABLGTK_DIR = @LABLGTK_INCLUDE@
LABLGTK_BYTE = $(LABLGTK_DIR) lablgtk.cma lablglade.cma
LABLGTK_OPT = $(LABLGTK_DIR) lablgtk.cmxa lablglade.cmxa
CAMOMILE_DIR = @CAMOMILE_INCLUDE@
CAMOMILE_BYTE = $(CAMOMILE_DIR) camomile.cma
CAMOMILE_OPT = $(CAMOMILE_DIR) camomile.cmxa
LABLWEBKIT_DIR = @LABLWEBKIT_INCLUDE@
LABLWEBKIT_BYTE = $(LABLWEBKIT_DIR) lablwebkit.cma
LABLWEBKIT_OPT = $(LABLWEBKIT_DIR) lablwebkit.cmxa
XMLLIGHT_DIR = @XMLLIGHT_INCLUDE@
XMLLIGHT_BYTE = $(XMLLIGHT_DIR) xml-light.cma
XMLLIGHT_OPT = $(XMLLIGHT_DIR) xml-light.cmxa
CAIRO_DIR = @CAIRO_INCLUDE@
CAIRO_BYTE = $(CAIRO_DIR) cairo2.cma
CAIRO_OPT = $(CAIRO_DIR) cairo2.cmxa
DEP2PICT_DIR = @DEP2PICT_INCLUDE@
DEP2PICT_BYTE = $(DEP2PICT_DIR) dep2pict.cma
DEP2PICT_OPT = $(DEP2PICT_DIR) dep2pict.cmxa
LIBGREW_DIR = @LIBGREW_INCLUDE@
LIBGREW_BYTE = $(LIBGREW_DIR) libgrew.cma
LIBGREW_OPT = $(LIBGREW_DIR) libgrew.cmxa
CLUSTER_DIR = @CLUSTER_INCLUDE@
CLUSTER_BYTE = $(CLUSTER_DIR) cluster.cma
CLUSTER_OPT = $(CLUSTER_DIR) cluster.cmxa
DEBUG = @DEBUG@
WARNING = @WARNING@
MESSAGE = @MESSAGE@
INFO = @INFO@
infos:
@echo ""
@echo "version -> " $(VERSION)
@echo ""
@echo "prefix -> " @prefix@
@echo "exec install dir -> " $(INSTALL_DIR)
@echo "data install dir -> " $(DATA_DIR)
@echo "doc install dir -> " $(DOC_DIR)
@echo ""
@echo "OCAMLC -> " $(OCAMLC)
@echo "OCAMLOPT -> " $(OCAMLOPT)
@echo "OCAMLLIB -> " $(OCAMLLIB)
@echo "OCAMLFIND -> " $(OCAMLFIND)
@echo "byte compil flags -> " $(BYTE_FLAGS)
@echo "native compil flags -> " $(OPT_FLAGS)
@echo ""
@echo "LABLGTK2 -> " $(LABLGTK_OPT)
@echo "LABLWEBKIT -> " $(LABLWEBKIT_OPT)
@echo "XMLLIGHT -> " $(XMLLIGHT_OPT)
@echo "DEP2PICT -> " $(DEP2PICT_OPT)
@echo "CAIRO -> " $(CAIRO_OPT)
@echo "LIBGREW -> " $(LIBGREW_OPT)
@echo "CLUSTER -> " $(CLUSTER_OPT)
@echo "LOG -> " $(LOG_OPT)
@echo "ANSITERMINAL -> " $(ANSITERMINAL_OPT)
@echo "CAMOMILE -> " $(CAMOMILE_OPT)
@echo "ITEXT -> " $(ITEXT_OPT)
@echo ""
@echo "DEBUG -> " $(DEBUG)
@echo "WARNING -> " $(WARNING)
@echo "MESSAGE -> " $(MESSAGE)
@echo "INFO -> " $(INFO)
@echo ""
@echo "BUILD GUI -> " @BUILD_GUI@
@echo "BUILD CLUSTER -> " @BUILD_CLUSTER@
@echo "USE DEP2PICT -> " @USE_DEP2PICT@
cleanup:
rm -rf *.cmo *.out *.cmi *.cmxa *.a *.cmx *~ *.o *.cmx *.cma test *.svg *.status *.h *.log autom4te.cache config/autom4te.cache
purge:
rm -rf Makefile
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
AC_INIT(grew, 1.0.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(
[dev],
[AS_HELP_STRING([--enable-dev],[Enable grew dev version (default is no)])],
[dev=$enableval],
[dev=no])
AC_ARG_ENABLE(
[cluster],
[AS_HELP_STRING([--enable-cluster],[Enable cluster (default is no)])],
[cluster=$enableval],
[cluster=no])
AC_ARG_ENABLE(
[gui],
[AS_HELP_STRING([--enable-gui],[build GUI extension (default is yes)])],
[with_gui=$enableval],
[with_gui=yes])
AC_ARG_ENABLE(
[dep2pict],
[AS_HELP_STRING([--enable-dep2pict],[build with dep2pict even if gui is disabled (default is yes)])],
[dep2pict=$enableval],
[dep2pict=yes])
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 "$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)
# 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)
m4_include(ac_lib_checking.m4)
AC_LIB_CHECKING(Xml-light,xml-light,xml-light,xml-light,XmlParser,"",true)
AC_SUBST(XMLLIGHT_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"",true,true)
AC_SUBST(ANSITERMINAL_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Log,log,log,log,Log,"",true,true)
AC_SUBST(LOG_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Itext,itext,itext,itext,Itext,"",true,true)
AC_SUBST(ITEXT_INCLUDE,$LIB_INCLUDE)
# DEP2PICT is available only if CAIRO and Dep2pict are found *)
if test "x$dep2pict" = xno ; then
AC_SUBST(USE_DEP2PICT,no)
else
AC_LIB_CHECKING(Cairo,cairo2,cairo2,cairo2,Cairo,"",false,true)
AC_SUBST(CAIRO_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Dep2pict,dep2pict,dep2pict,dep2pict,Dep2pict,"",false,true)
AC_SUBST(DEP2PICT_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Camomile,camomile,camomile,camomile,"CamomileLibraryDefault","bigarray.cma",true)
AC_SUBST(CAMOMILE_INCLUDE,$LIB_INCLUDE)
if test "$CAIRO_INCLUDE" = "no" ;
then AC_SUBST(USE_DEP2PICT,no)
else
if test "$DEP2PICT_INCLUDE" = "no";
then AC_SUBST(USE_DEP2PICT,no)
else AC_SUBST(USE_DEP2PICT,yes)
fi
fi
fi
AC_SUBST(USE_DEP2PICT)
# GUI is available only if LALGTK and LABLWEBKIT are found *)
if test "x$with_gui" = xno ; then
AC_SUBST(BUILD_GUI,no)
else
AC_LIB_CHECKING(Lablgtk2,lablgtk2,lablgtk2,lablgtk,GMain,"",false,true)
AC_SUBST(LABLGTK_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Lablwebkit,lablwebkit,lablwebkit,lablwebkit,GWebView,"$LABLGTK_INCLUDE lablgtk.cma",false,true)
AC_SUBST(LABLWEBKIT_INCLUDE,$LIB_INCLUDE)
if test "$LABLGTK_INCLUDE" = "no" ;
then AC_SUBST(BUILD_GUI,no)
else
if test "$LABLWEBKIT_INCLUDE" = "no";
then AC_SUBST(BUILD_GUI,no)
else AC_SUBST(BUILD_GUI,yes)
fi
fi
fi
AC_SUBST(BUILD_GUI)
BUILD_CLUSTER="no"
if test "$cluster" = "yes"; then
AC_LIB_CHECKING(Cluster,cluster,cluster,cluster,Cluster,"",true,true)
AC_SUBST(CLUSTER_INCLUDE,$LIB_INCLUDE)
BUILD_CLUSTER="yes"
if test "$CLUSTER_INCLUDE" = "no"; then
BUILD_CLUSTER="no"
fi
fi
AC_SUBST(BUILD_CLUSTER)
if test "x$dev" = xno ; then
AC_LIB_CHECKING(Libgrew,libgrew,libgrew,libgrew,Libgrew,"",true)
AC_SUBST(LIBGREW_INCLUDE,$LIB_INCLUDE)
else
AC_SUBST(DEV,yes)
AC_LIB_CHECKING(Libgrew,libgrew,libgrew_dev,libgrew,Libgrew,"",true)
AC_SUBST(LIBGREW_INCLUDE,$LIB_INCLUDE)
fi
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
AC_SUBST(LIB)
fi
AC_SUBST(SET_MAKE)
AC_CONFIG_FILES(config/Makefile Makefile src/Makefile)
AC_PROG_MAKE_SET
AC_OUTPUT
cd config && make infos
echo ""
This diff is collapsed.
open Ocamlbuild_plugin
let read file =
let in_ch = open_in file in
try
let v = input_line in_ch in
close_in in_ch;
v
with End_of_file -> failwith ("Error loading file: "^file)
let () =
dispatch begin function
| After_rules ->
let pp_src = S[A"-pp"; A("camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\\\""^(read "DATA_DIR")^"\\\" -DVERSION=\\\""^(read "VERSION")^"\\\"")] in
flag ["ocaml"; "ocamldep"] & pp_src;
flag ["ocaml"; "compile"] & pp_src;
| _ -> ()
end
......@@ -5,5 +5,15 @@ build: [
["make"]
["make" "install"]
]
depends: ["lablgtk" "lablwebkit" "cairo2" "xml-light" "ANSITerminal" "libcaml-log" "libcaml-itext" "camomile" "libcaml-dep2pict" "libcaml-grew"]
depends: [
"lablgtk"
"lablwebkit"
"cairo2"
"xml-light"
"ANSITerminal"
"libcaml-log"
"libcaml-itext"
"camomile"
"libcaml-dep2pict"
"libcaml-grew"
]
include ../config/Makefile
.PHONY: grew
ifeq (@USE_DEP2PICT@,yes)
D2P_OPT = bigarray.cmxa $(CAIRO_OPT) $(CAMOMILE_OPT) $(DEP2PICT_OPT)
else
D2P_OPT =
endif
ifeq (@BUILD_GUI@,yes)
GTK_OPT = $(LABLGTK_OPT) $(LABLWEBKIT_OPT)
else
GTK_OPT =
endif
grew:
ifeq (@BUILD_GUI@,yes)
ifeq (@BUILD_CLUSTER@,yes)
@make grew_gtk
else
@make grew_gtk_nocluster
endif
else
ifeq (@BUILD_CLUSTER@,yes)
@make grew_nogtk
else
@make grew_nogtk_nocluster
endif
endif
grew_gtk: grew_glade.cmx grew_main.cmx
$(OCAMLOPT) -o grew unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) \
$(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) $(CLUSTER_OPT) \
grew_config.cmx grew_args.cmx grew_utils.cmx grew_rew_display.cmx grew_glade.cmx grew_gtk.cmx grew_corpus.cmx grew_cluster.cmx grew_main.cmx
rm -rf ../grew
rm -rf ../grew.glade
ln -s `pwd`/grew ../grew
ln -s `pwd`/grew.glade ../grew.glade
grew_gtk_nocluster: grew_glade.cmx grew_main_nocluster.cmx
$(OCAMLOPT) -o grew unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) \
$(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) \
grew_config.cmx grew_args.cmx grew_utils.cmx grew_rew_display.cmx grew_glade.cmx grew_gtk.cmx grew_corpus.cmx grew_main.cmx
rm -rf ../grew
rm -rf ../grew.glade
ln -s `pwd`/grew ../grew
ln -s `pwd`/grew.glade ../grew.glade
grew_nogtk: grew_main_nogtk.cmx
$(OCAMLOPT) -o grew unix.cmxa -I +threads threads.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) $(CLUSTER_OPT) \
grew_config.cmx grew_args.cmx grew_utils.cmx grew_corpus.cmx grew_cluster.cmx grew_main.cmx
grew_nogtk_nocluster: grew_main_nogtk_nocluster.cmx
$(OCAMLOPT) -o grew unix.cmxa -I +threads threads.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) \
grew_config.cmx grew_args.cmx grew_utils.cmx grew_corpus.cmx grew_main.cmx
grew_glade.ml: grew.glade
lablgladecc2 grew.glade > grew_glade.ml
sed -itmp "s|grew.glade|$(DATA_DIR)grew.glade|" grew_glade.ml
rm grew_glade.mltmp
grew_glade.cmx: grew_glade.ml
$(OCAMLOPT) -c $(GTK_OPT) grew_glade.ml
grew_main.cmx: grew_main.ml grew_config.cmx grew_glade.cmx grew_rew_display.cmx grew_utils.cmx grew_args.cmx grew_gtk.cmx grew_corpus.cmx grew_cluster.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DBUILD_CLUSTER' unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_main.ml
grew_main_nocluster.cmx: grew_main.ml grew_config.cmx grew_glade.cmx grew_rew_display.cmx grew_utils.cmx grew_args.cmx grew_gtk.cmx grew_corpus.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI' unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_main.ml
grew_main_nogtk.cmx: grew_main.ml grew_config.cmx grew_args.cmx grew_cluster.cmx grew_corpus.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_CLUSTER' unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_main.ml
grew_main_nogtk_nocluster.cmx: grew_main.ml grew_config.cmx grew_args.cmx grew_corpus.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo' unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_main.ml
grew_gtk.cmx: grew_gtk.ml grew_config.cmx grew_glade.cmx grew_rew_display.cmx grew_utils.cmx grew_args.cmx
$(OCAMLOPT) -c unix.cmxa -I +threads threads.cmxa str.cmxa $(GTK_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_gtk.ml
grew_corpus.cmx: grew_corpus.ml grew_utils.cmx grew_args.cmx
$(OCAMLOPT) -c unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_corpus.ml
grew_cluster.cmx: grew_cluster.ml grew_args.cmx grew_utils.cmx grew_corpus.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DINSTALL_DIR=\"$(INSTALL_DIR)\"' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(XMLLIGHT_OPT) $(D2P_OPT) $(LIBGREW_OPT) $(CLUSTER_OPT) grew_cluster.ml
grew_rew_display.cmx: grew_rew_display.ml grew_utils.cmx
ifeq (@USE_DEP2PICT@,yes)
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.cmx grew_rew_display.ml
else
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.cmx grew_rew_display.ml
endif
grew_utils.cmx: grew_utils.ml grew_args.cmx
ifeq (@USE_DEP2PICT@,yes)
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.ml
else
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_utils.ml
endif
grew_args.cmx: grew_args.ml
ifeq (@USE_DEP2PICT@,yes)
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDEP2PICT' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_args.ml
else
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo' unix.cmxa str.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) $(D2P_OPT) $(LIBGREW_OPT) grew_args.ml
endif
grew_config.cmx: grew_config.ml
$(OCAMLOPT) -c unix.cmxa $(ANSITERMINAL_OPT) $(LOG_OPT) grew_config.ml
clean: cleanup
rm -rf grew_glade.ml grew
......@@ -122,19 +122,6 @@ module Grew_args = struct
]
let parse () =
Arg.parse args (fun s -> Printf.printf "%s" s) usage;
IFDEF DEP2PICT THEN
()
ELSE
match !html with
| No -> ()
| _ ->
(match !no_init with
| true -> ()
| false -> Log.message "Cannot display init graph without dep2pict --> no_init = true"; no_init := true);
(match !dot with
| true -> ()
| false -> Log.message "Cannot display dep normal forms without dep2pict --> dot = true"; dot := true);
END
Arg.parse args (fun s -> Printf.printf "%s" s) usage
end
......@@ -10,6 +10,7 @@
open Printf
open Log
open Conll
open Libgrew
......@@ -28,7 +29,6 @@ let fail kind msg loc_opt =
let handle fct () =
try fct ()
with
| Libgrew.File_dont_exists file -> fail "IO" (sprintf "File not found: \"%s\"" file) None
| Libgrew.Bug (msg,loc_opt) -> fail "Bug" msg loc_opt
| Libgrew.Build (msg,loc_opt) -> fail "Build" msg loc_opt
......@@ -62,8 +62,8 @@ let init () =
let _ = Grs.build_html_doc ~corpus:true (Filename.concat output_dir "doc") grs in
(* get the list of graphs to rewrite *)
let graph_list = Corpus.get_graphs domain !Grew_args.input_data in
let base_names = List.map fst graph_list in
let graph_array = Corpus.get_graphs domain !Grew_args.input_data in
let base_names = Array.map fst graph_array in
(* put the list of files to consider in the [index] file *)
Rewrite.save_index ~dirname:output_dir ~base_names;
......@@ -72,7 +72,6 @@ let init () =
let _ = Sys.command (sprintf "cp %s %s" !Grew_args.grs output_dir) in
let sentences = ref [] in
let graph_array = Array.of_list graph_list in
let len = Array.length graph_array in
Array.iteri
......@@ -163,17 +162,17 @@ let multi_conll ?(keep_empty_rh=false) () =
let domain = Grs.get_domain grs in
(* get the list of files to rewrite *)
let graph_list = Corpus.get_graphs domain !Grew_args.input_data in
let len = List.length graph_list in
let graph_array = Corpus.get_graphs domain !Grew_args.input_data in
let len = Array.length graph_array in
List.iteri
Array.iteri
(fun index (base_name, gr) ->
Counter.print index len base_name;
let rh = Rewrite.rewrite ~gr ~grs ~seq:!Grew_args.seq in
match Rewrite.conll_dep_string domain ~keep_empty_rh rh with
| None -> ()
| Some string -> fprintf out_ch "%s\n" string
) graph_list;
) graph_array;
close_out out_ch;
Counter.finish ()
) ()
......@@ -207,17 +206,17 @@ let det () =
let domain = Grs.get_domain grs in
(* get the list of graphs to rewrite *)
let graph_list = Corpus.get_graphs domain !Grew_args.input_data in
let len = List.length graph_list in
let graph_array = Corpus.get_graphs domain !Grew_args.input_data in
let len = Array.length graph_array in
List_.iteri
Array.iteri
(fun index (base_name, gr) ->
Counter.print index len base_name;
let output_base = Filename.concat output_dir base_name in
let rh = Rewrite.rewrite ~gr ~grs ~seq:!Grew_args.seq in
if !Grew_args.out_gr then Rewrite.save_det_gr domain output_base rh;
if !Grew_args.out_conll then Rewrite.save_det_conll domain output_base rh
) graph_list;
) graph_array;
Counter.finish ()
) ()
......@@ -250,17 +249,17 @@ let full () =
let domain = Grs.get_domain grs in
(* get the list of graphs to rewrite *)
let graph_list = Corpus.get_graphs domain !Grew_args.input_data in
let len = List.length graph_list in
let graph_array = Corpus.get_graphs domain !Grew_args.input_data in
let len = Array.length graph_array in
List_.iteri
Array.iteri
(fun index (base_name, gr) ->
Counter.print index len base_name;
let output_base = Filename.concat output_dir base_name in
let rh = Rewrite.rewrite ~gr ~grs ~seq:!Grew_args.seq in
if !Grew_args.out_gr then failwith "Not yet";
if !Grew_args.out_conll then ignore (Rewrite.save_full_conll domain output_base rh)
) graph_list;
) graph_array;
Counter.finish ()
) ()
......@@ -287,7 +286,7 @@ let full () =
let domain = Grs.get_domain (Grs.load grs_file) in
(* get the list of graphs to explore *)
let graph_array = Array.of_list (Corpus.get_graphs domain data_file) in
let graph_array = Corpus.get_graphs domain data_file in
let pattern = Pattern.load domain pattern_file in
......@@ -318,7 +317,7 @@ let make_index () =
| Some s -> s
| None -> sprintf "Index for file in input_data '%s'" !Grew_args.input_data in
let grs = Grs.load !Grew_args.grs in
let base_names = File.read (Filename.concat output_dir "index") in
let base_names = Array.of_list (File.read (Filename.concat output_dir "index")) in
Rewrite.make_index
~title: title
~grs_file: !Grew_args.grs
......@@ -359,15 +358,15 @@ let annot () =
let domain = Grs.get_domain grs in
(* get the list of graphs to rewrite *)
let graph_list = Corpus.get_graphs domain !Grew_args.input_data in
let len = List.length graph_list in
let graph_array = Corpus.get_graphs domain !Grew_args.input_data in
let len = Array.length graph_array in
let bn_rh_list =
List_.mapi
let bn_rh_array =
Array.mapi
(fun index (base_name, gr) ->
Counter.print index len base_name;
(base_name, Rewrite.rewrite ~gr ~grs ~seq:!Grew_args.seq)
) graph_list in
) graph_array in
Counter.finish ();
Rewrite.write_annot domain ~title static_dir annot_dir bn_rh_list
Rewrite.write_annot domain ~title static_dir annot_dir (Array.to_list bn_rh_array)
) ()
......@@ -60,7 +60,7 @@ module Grew_rew_display = struct
save output_file (to_grstring_graph grs graph_id)
let to_conll_graph grs graph_id =
Graph.to_conll grs (get_graph graph_id)
Graph.to_conll_string grs (get_graph graph_id)
let save_conll_graph grs graph_id output_file =
save output_file (to_conll_graph grs graph_id)
......@@ -79,7 +79,6 @@ module Grew_rew_display = struct
Pdf.dot_to_file dot output_file
IFDEF DEP2PICT THEN
let to_pngfile_graph grs ?deco ?main_feat graph_id output_file =
let dep = to_depstring_graph grs ?deco ?main_feat graph_id in
let d2p = Dep2pict.Dep2pict.from_dep ~dep in
......@@ -94,17 +93,6 @@ IFDEF DEP2PICT THEN
let dep = to_depstring_graph grs ?deco ?main_feat graph_id in
let d2p = Dep2pict.Dep2pict.from_dep ~dep in
Dep2pict.Dep2pict.save_svg ~filename:output_file d2p
ELSE
let to_pngfile_graph grs ?