Commit ff2f32e7 authored by bguillaum's avatar bguillaum

version 2.21: mv to ocamlbuild

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/semagramme/dep2pict/trunk@8865 7838e531-6607-4d57-9587-6c381814729c
parent 74c24d0d
PREFIX?=/usr/local
BINDIR=$(PREFIX)/bin
DATA_DIR=$(PREFIX)/share/dep2pict/
OCB_FLAGS = -use-ocamlfind -I src
OCB = ocamlbuild $(OCB_FLAGS)
VERSION = `cat VERSION`
all: native
native: src/dep2pict_glade.ml datadir
$(OCB) main.native
datadir:
echo $(DATA_DIR) > DATA_DIR
install:
cp main.native $(BINDIR)/dep2pict
mkdir -p $(DATA_DIR)
cp src/dep2pict.glade $(DATA_DIR)
uninstall:
rm -f $(BINDIR)/dep2pict
rm -f $(DATA_DIR)/dep2pict.glade
.PHONY: all clean byte native install uninstall
clean:
$(OCB) -clean
rm -f DATA_DIR
rm -f src/dep2pict_glade.ml
info:
@echo "BINDIR = $(BINDIR)"
@echo "DATA_DIR = $(DATA_DIR)"
# glade file are not handle by ocamlbuild
src/dep2pict_glade.ml : src/dep2pict.glade
lablgladecc2 $< > $@
sed -iback 's|src/dep2pict.glade|$(DATA_DIR)dep2pict.glade|g' src/dep2pict_glade.ml
rm -f src/dep2pict_glade.mlback
all: opt
include config/Makefile
byte :
@make -C src byte
opt :
ifeq (@BUILD_GUI@,yes)
@make -C src opt_gtk
else
@make -C src opt
endif
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
install : opt
cp bin/dep2pict.opt $(INSTALL_DIR)/dep2pict
ifeq (@BUILD_GUI@,yes)
mkdir -p $(DATA_DIR)
cp src/dep2pict.glade $(DATA_DIR)
cp img/* $(DATA_DIR)
endif
clean :
@make cleanup
@make -C config cleanup
@make -C src cleanup
purge_makefile :
@make purge
@make -C src purge
@make -C config purge
destroot:
mkdir -p $(DESTDIR)$(INSTALL_DIR)
mkdir -p $(DESTDIR)$(DATA_DIR)
cp bin/dep2pict.opt $(DESTDIR)$(INSTALL_DIR)/dep2pict
ifeq (@BUILD_GUI@,yes)
cp src/dep2pict.glade $(DESTDIR)$(DATA_DIR)
cp img/* $(DESTDIR)$(DATA_DIR)
endif
true: package(str, ANSITerminal, camomile, cairo2, log, dep2pict, lablgtk2, lablgtk2.rsvg, lablgtk2.glade, lablwebkit)
VERSION = 2.20
INSTALL_DIR = @prefix@@bindir@
DATA_DIR = @prefix@@datarootdir@/dep2pict/
DOC_DIR = @docdir@dep2pict/
BYTE_FLAGS = -g -dtypes
OPT_FLAGS =
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLLIB = @OCAMLLIB@
OCAMLYACC = @OCAMLYACC@
OCAMLLEX = @OCAMLLEX@
OCAMLFIND = @OCAMLFIND@
ANSITERMINAL_DIR = @ANSITERMINAL_INCLUDE@
ANSITERMINAL_BYTE = $(ANSITERMINAL_DIR) ANSITerminal.cma
ANSITERMINAL_OPT = $(ANSITERMINAL_DIR) ANSITerminal.cmxa
CAMOMILE_DIR = @CAMOMILE_INCLUDE@
CAMOMILE_BYTE = $(CAMOMILE_DIR) camomile.cma
CAMOMILE_OPT = $(CAMOMILE_DIR) camomile.cmxa
XML_LIGHT_DIR = @XMLLIGHT_INCLUDE@
XML_LIGHT_BYTE = $(XML_LIGHT_DIR) xml-light.cma
XML_LIGHT_OPT = $(XML_LIGHT_DIR) xml-light.cmxa
CAIRO_DIR = @CAIRO_INCLUDE@
CAIRO_BYTE = $(CAIRO_DIR) cairo2.cma
CAIRO_OPT = $(CAIRO_DIR) cairo2.cmxa
LABLWEBKIT_DIR = @LABLWEBKIT_INCLUDE@
LABLWEBKIT_BYTE = $(LABLWEBKIT_DIR) lablwebkit.cma
LABLWEBKIT_OPT = $(LABLWEBKIT_DIR) lablwebkit.cmxa
LABLGTK_DIR = @LABLGTK_INCLUDE@
LABLGTK_BYTE = $(LABLGTK_DIR) lablgtk.cma lablglade.cma lablrsvg.cma
LABLGTK_OPT = $(LABLGTK_DIR) lablgtk.cmxa lablglade.cmxa lablrsvg.cmxa
DEP2PICT_DIR = @DEP2PICT_INCLUDE@
DEP2PICT_BYTE = $(DEP2PICT_DIR) dep2pict.cma
DEP2PICT_OPT = $(DEP2PICT_DIR) dep2pict.cmxa
LOG_DIR = @LOG_INCLUDE@
LOG_BYTE = $(LOG_DIR) log.cma
LOG_OPT = $(LOG_DIR) log.cmxa
DEBUG = @DEBUG@
WARNING = @WARNING@
MESSAGE = @MESSAGE@
INFO = @INFO@
SYSTEM = @SYSTEM@
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 "BUILD_GUI -> " @BUILD_GUI@
@echo ""
@echo "byte compil flags -> " $(BYTE_FLAGS)
@echo "native compil flags -> " $(OPT_FLAGS)
@echo ""
@echo "OCAMLLIB -> " $(OCAMLLIB)
@echo "OCAMLYACC -> " $(OCAMLYACC)
@echo "OCAMLLEX -> " $(OCAMLLEX)
@echo "OCAMLFIND -> " $(OCAMLFIND)
@echo "LABLGTK -> " $(LABLGTK_OPT)
@echo "CAIRO -> " $(CAIRO_OPT)
@echo "DEP2PICT -> " $(DEP2PICT_OPT)
@echo "LOG -> " $(LOG_OPT)
@echo "ANSITERMINAL -> " $(ANSITERMINAL_OPT)
@echo "XML_LIGHT -> " $(XML_LIGHT_OPT)
@echo ""
@echo "DEBUG -> " $(DEBUG)
@echo "WARNING -> " $(WARNING)
@echo "MESSAGE -> " $(MESSAGE)
@echo "INFO -> " $(INFO)
@echo ""
@echo "SYSTEM -> " $(SYSTEM)
cleanup:
rm -rf *.cmo *.out *.cmi *.mli deplex.ml deppars.ml *.cmxa *.a *.cmx *~ *.o *.cmx *.cma test *.svg ui.ml *.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.63])
AC_INIT(dep2pict, 2.7.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(
[gui],
[AS_HELP_STRING([--enable-gui],[build GUI extension (default is yes)])],
[with_gui=$enableval],
[with_gui=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 camllex and camlyacc
AC_PATH_PROG(OCAMLLEX,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex)
fi
AC_SUBST(OCAMLLEX)
AC_PATH_PROG(OCAMLYACC,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc)
fi
AC_SUBST(OCAMLYACC)
# Look for ocamlfind
AC_PATH_PROG(OCAMLFIND,ocamlfind,no)
if test "$OCAMLFIND" = no ; then
AC_MSG_WARN(Cannot find ocamlfind)
fi
AC_SUBST(OCAMLFIND)
m4_include(ac_lib_checking.m4)
AC_LIB_CHECKING(Cairo,cairo2,cairo2,cairo2,Cairo,"",true,true)
AC_SUBST(CAIRO_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Dep2pict,dep2pict,dep2pict,dep2pict,Dep2pict,"",true,true)
AC_SUBST(DEP2PICT_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Camomile,camomile,camomile,camomile,"CamomileLibraryDefault","bigarray.cma",true)
AC_SUBST(CAMOMILE_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Log,log,log,log,Log,"",true,true)
AC_SUBST(LOG_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,ANSITerminal,"",true,true)
AC_SUBST(ANSITERMINAL_INCLUDE,$LIB_INCLUDE)
AC_LIB_CHECKING(Xml-light,xml-light,xml-light,xml-light,XmlParser,"",true)
AC_SUBST(XMLLIGHT_INCLUDE,$LIB_INCLUDE)
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 "$CAIRO_INCLUDE" = no ;
then AC_SUBST(BUILD_GUI,no)
else AC_SUBST(BUILD_GUI,yes)
fi
fi
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
#lib directory
LIB=`pwd`/lib
AC_SUBST(LIB)
# System
SYSTEM=`uname`
AC_SUBST(SYSTEM)
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 source diff could not be displayed because it is too large. You can view the blob instead.
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 -DDATA_DIR=\\\""^(read "DATA_DIR")^"\\\" -DVERSION=\\\""^(read "VERSION")^"\\\"")] 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"
"libcaml-log"
"cairo2"
"camomile"
"lablgtk"
"libcaml-dep2pict"
]
opam-version: "1"
maintainer: "Bruno.Guillaume@loria.fr"
build: [
["./configure" "--prefix" prefix]
["make"]
["make" "install"]
]
depends: ["ANSITerminal" "camomile" "libcaml-log" "cairo2" "lablgtk" "libcaml-dep2pict"]
include ../config/Makefile
LOG = -DDEBUG=\"@DEBUG@\" -DINFO=\"@INFO@\" -DMESSAGE=\"@MESSAGE@\" -DWARNING=\"@WARNING@\"
opt_gtk : dep2pict_glade.ml dep2pict_glade.cmx gui.cmx main.cmx ../bin/dep2pict.opt
opt : main.cmx ../bin/dep2pict.opt
dep2pict_glade.ml : dep2pict.glade
@echo " ----> build file 'dep2pict_glade.ml' from 'dep2pict.glade'"
lablgladecc2 dep2pict.glade > dep2pict_glade.ml
@echo " ----> set absolute file location in 'dep2pict_glade.ml' (DATA_DIR = $(DATA_DIR))"
sed -iback 's|dep2pict.glade|$(DATA_DIR)dep2pict.glade|g' dep2pict_glade.ml
rm -f dep2pict_glade.mlback
# dep2pict_glade.ml : dep2pict.glade
# sed 's/<property name="invisible_char">&#x25CF;<\/property>//g' dep2pict.glade > glade.tmp
# mv glade.tmp dep2pict.glade.ml
# lablgladecc2 dep2pict.glade.ml > dep2pict_glade.ml
# rm dep2pict.glade.ml
# sed 's|dep2pict.glade.ml|$(DATA_DIR)dep2pict.glade|g' dep2pict_glade.ml > dep2pict_glade.tmp
# mv dep2pict_glade.tmp dep2pict_glade.ml
dep2pict_glade.cmx : dep2pict_glade.ml
$(OCAMLOPT) -c $(LABLGTK_OPT) $(LABLWEBKIT_OPT) $(CAIRO_OPT) dep2pict_glade.ml
DEP_OPT= unix.cmxa str.cmxa bigarray.cmxa $(LABLGTK_OPT) $(LABLWEBKIT_OPT) $(CAIRO_OPT) $(CAMOMILE_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
DEP_OPT_NOGUI= unix.cmxa str.cmxa bigarray.cmxa $(CAIRO_OPT) $(CAMOMILE_OPT) $(XML_LIGHT_OPT) $(ANSITERMINAL_OPT) $(LOG_OPT) $(DEP2PICT_OPT)
global.cmx : global.ml
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) global.ml
gui.cmx : gui.ml global.cmx dep2pict_glade.cmx
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) dep2pict_glade.cmx gui.ml
main.cmx : main.ml global.cmx
ifeq (@BUILD_GUI@,yes)
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) dep2pict_glade.cmx global.cmx gui.cmx main.ml
else
$(OCAMLOPT) -c -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) global.cmx main.ml
endif
../bin/dep2pict.opt : main.cmx
mkdir -p ../bin
ifeq (@BUILD_GUI@,yes)
$(OCAMLOPT) -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DBUILD_GUI -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT) dep2pict_glade.cmx global.cmx gui.cmx main.cmx
else
$(OCAMLOPT) -o ../bin/dep2pict.opt -pp 'camlp4o pa_macro.cmo -DDATA_DIR=\"$(DATA_DIR)\" $(LOG) -DVERSION=\"$(VERSION)\"' $(DEP_OPT_NOGUI) global.cmx main.cmx
endif
......@@ -4,13 +4,6 @@ open Dep2pict
open Global
IFDEF BUILD_GUI THEN
open Gui
let gui () = Gui.main ()
ELSE
let gui () = Log.critical "Gui not available"
END
let version = VERSION
let _ =
......@@ -123,7 +116,7 @@ let _ =
end;
match !output_file with
| None -> gui ()
| None -> Gui.main ()
| Some out_file ->
try
let graph = match !current_data with
......
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