Commit a598a0cd authored by Pietro Abate's avatar Pietro Abate

[r2003-05-26 16:23:52 by cvscast] Beppe: Added install and configure stuff

Original author: cvscast
Date: 2003-05-26 16:23:52+00:00
parent 4abc15c4
#
# sample Makefile for Objective Caml
# Copyright (C) 2001 Jean-Christophe FILLIATRE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU Library General Public License version 2 for more details
# (enclosed in the file LGPL).
# where to install the binaries
prefix=@prefix@
exec_prefix=@exec_prefix@
BINDIR=@bindir@
# where to install the man page
MANDIR=@mandir@
# other variables set by ./configure
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLDEP = @OCAMLDEP@
OCAMLLEX = @OCAMLLEX@
OCAMLYACC= @OCAMLYACC@
OCAMLLIB = @OCAMLLIB@
OCAMLBEST= @OCAMLBEST@
OCAMLVERSION = @OCAMLVERSION@
OCAMLWEB = @OCAMLWEB@
OCAMLWIN32 = @OCAMLWIN32@
EXE = @EXE@
INCLUDES =
BFLAGS = -g $(INCLUDES)
OFLAGS = $(INCLUDES)
# main target
#############
NAME = cduce
NATIVE = true
PROFILE = false
PXP_WLEX = false
PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true)
PACKAGES += -package pxp-wlex-utf8
else
PACKAGES += -package pxp-lex-utf8
endif
SYNTAX = camlp4o pa_extend.cmo
VERSION = 0.0.91
ifeq ($(PROFILE), true)
CAMLC_P = ocamlcp -p a
CAMLOPT_P = ocamlopt -p
SYNTAX_PARSER =
else
CAMLC_P = ocamlc
CAMLOPT_P = ocamlopt
SYNTAX_PARSER = -pp '$(SYNTAX)'
endif
OPT = -warn-error A
CAMLC = ocamlfind $(CAMLC_P) $(OPT) $(PACKAGES)
CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES)
ifeq ($(NATIVE), true)
EXTENSION = cmx
LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
else
EXTENSION = cmo
LINK = $(CAMLC) -custom -linkpkg gramlib.cma
endif
all: cduce dtd2cduce local_website
# Source directories
DIRS = misc parser typing types runtime driver
CLEAN_DIRS = $(DIRS) tools tests
# Objects to build
OBJECTS = \
misc/cduce_config.cmo \
misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
misc/pretty.cmo \
\
types/sortedList.cmo types/boolean.cmo types/ident.cmo \
types/intervals.cmo types/chars.cmo types/atoms.cmo types/normal.cmo \
types/types.cmo types/patterns.cmo types/sequence.cmo \
types/sample.cmo \
\
parser/location.cmo parser/wlexer.cmo parser/ast.cmo parser/parser.cmo \
\
typing/typed.cmo typing/typer.cmo \
\
runtime/value.cmo runtime/load_xml.cmo runtime/run_dispatch.cmo \
runtime/print_xml.cmo runtime/eval.cmo \
\
types/builtin.cmo driver/cduce.cmo
CDUCE = $(OBJECTS) driver/run.cmo
WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
DTD2CDUCE = tools/dtd2cduce.cmo
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)
PREPRO = $(SYNTAX) pr_o.cmo
misc/cduce_config.cmo: misc/cduce_config.ml
$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
rm -f misc/cduce_config.ml
misc/cduce_config.cmx: misc/cduce_config.ml
$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
rm -f misc/cduce_config.ml
misc/cduce_config.ml:
sed -e 's|%%VERSION%%|$(VERSION)|' \
-e 's|%%BUILD_DATE%%|$(shell date +%Y-%m-%d)|' \
-e 's|%%NATIVE%%|$(NATIVE)|' \
misc/cduce_config.mlp > misc/cduce_config.ml
cduce: $(CDUCE:.cmo=.$(EXTENSION))
$(LINK) $(INCLUDES) -o $@ $^
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
$(LINK) -o $@ $^
dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION))
$(LINK) -o $@ $^
.PHONY: compute_depend
compute_depend:
@echo "Computing dependencies ..."
ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
parser/wlexer.ml: parser/wlexer.mll
wlex parser/wlexer.mll
# bytecode and native-code compilation
######################################
CMO =
CMX = $(CMO:.cmo=.cmx)
GENERATED = version.ml
byte: $(NAME).byte
opt: $(NAME).opt
$(NAME).byte: $(CMO)
$(OCAMLC) $(BFLAGS) -o $@ $^
$(NAME).opt: $(CMX)
$(OCAMLOPT) $(OFLAGS) -o $@ $^
version.ml: Makefile
echo "let version = \""$(VERSION)"\"" > version.ml
echo "let date = \""`date`"\"" >> version.ml
# installation
##############
install-indep:
mkdir -p $(BINDIR)
mkdir -p $(MANDIR)/man1
cp -f doc/$(NAME).1 $(MANDIR)/man1
install: install-indep
cp -f $(NAME) $(BINDIR)/$(NAME)$(EXE)
# generic rules
###############
.SUFFIXES: .mli .ml .cmi .cmo .cmx
.ml.cmo:
$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.ml.cmx:
$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
.mli.cmi:
$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
include depend
# CDuce-generated files
driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml
(cd web/examples; ../../cduce --quiet build.cd)
web/files: cduce web/site.cd
(cd web; ../cduce --quiet site.cd --arg -php site.xml)
#
# Customize the following variables to match the settings
# of your local web server
#
WEB_PREFIX = /var/www
CGI_DIR = $(WEB_PREFIX)/cgi-bin
CDUCE_HTML_DIR = $(WEB_PREFIX)/html
install_web_local:web/files webiface
cp web/www/*.php web/cduce.css $(CDUCE_HTML_DIR)/
cp webiface $(CGI_DIR)/
if test ! -d "$(CDUCE_HTML_DIR)/img" ; then \
mkdir $(CDUCE_HTML_DIR)/img; \
fi;
cp web/img/*.* $(CDUCE_HTML_DIR)/img
local_website: cduce
(cd web; ../cduce --quiet site.cd --arg site.xml)
# Makefile is rebuilt whenever Makefile.in or configure.in is modified
######################################################################
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
configure: configure.in
autoconf
# clean
#######
clean::
for i in $(CLEAN_DIRS); do \
(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
done
rm -f `find -name "*~"`
rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
rm -f cduce ocamlprof.dump
rm -f dtd2cduce pool webiface
rm -Rf prepro package
rm -f web/www/*.php web/www/*.html web/*~
dist-clean distclean:: clean
rm -f Makefile config.cache config.log config.status
include Makefile.distrib
# For development
pull: tools/pull.$(EXTENSION)
$(LINK) -o $@ $^
profile:
rm -Rf prepro
mkdir prepro
for i in $(DIRS); do \
mkdir prepro/$$i; \
for j in $$i/*.ml $$i/*.mli; do \
if [ -f "$$j" ]; then \
echo $$j; \
$(PREPRO) $$j -o prepro/$$j; \
fi; \
done; \
done
cp parser/wlexer.mll prepro/parser/
cp Makefile depend prepro/
(cd prepro; make cduce PROFILE=true SYNTAX_PARSER= NATIVE=false)
# Site-specific installation
cedre_build:
rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface; make web/files"
install_web:
scp web/www/*.php web/cduce.css cduce@iris:public_html/
scp webiface cduce@iris:cgi-bin/cduce
ssh cduce@iris "chmod +s cgi-bin/cduce"
website: web/files
scp web/www/*.php web/cduce.css cduce@iris.ens.fr:public_html/
# Packaging
DISTRIB = $(DIRS) tools web depend INSTALL INSTALL.WIN32 CHANGES LICENSE README doc
PACKAGE = $(NAME)-$(VERSION)
.PHONY: package
package:
rm -Rf $(PACKAGE)
mkdir $(PACKAGE)
cp -R $(DISTRIB) $(PACKAGE)/
cp Makefile.distrib.in $(PACKAGE)/Makefile.in
cp configure.distrib.in $(PACKAGE)/configure.in
(cd $(PACKAGE); \
autoconf;\
rm -f types/IDEAS; \
headache -h ../header $(DEPEND))
tar czf $(PACKAGE).tar.gz --exclude CVS --exclude ".#*" --exclude IDEAS $(PACKAGE)
rm -Rf $(PACKAGE)
#
# autoconf input for Objective Caml programs
# Copyright (C) 2001 Jean-Christophe Fillitre
# from a first script by Georges Mariano
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU Library General Public License version 2 for more details
# (enclosed in the file LGPL).
# the script generated by autoconf from this input will set the following
# variables:
# OCAMLC "ocamlc" if present in the path, or a failure
# or "ocamlc.opt" if present with same version number as ocamlc
# OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no"
# OCAMLBEST either "byte" if no native compiler was found,
# or "opt" otherwise
# OCAMLDEP "ocamldep"
# OCAMLLEX "ocamllex" (or "ocamllex.opt" if present)
# OCAMLYACC "ocamlyac"
# OCAMLLIB the path to the ocaml standard library
# OCAMLVERSION the ocaml version number
# OCAMLWEB "ocamlweb" (not mandatory)
# OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32"
# EXE ".exe" if OCAMLWIN32=yes, "" otherwise
# check for one particular file of the sources
# ADAPT THE FOLLOWING LINE TO YOUR SOURCES!
AC_INIT(driver/cduce.mli)
# Check for Ocaml compilers
# we first look for ocamlc in the path; if not present, we fail
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
# we extract Ocaml version number and library path
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "`
echo "ocaml library path is $OCAMLLIB"
# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
AC_MSG_CHECKING(ocamlopt version)
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
OCAMLOPT=no
else
AC_MSG_RESULT(ok)
OCAMLBEST=opt
fi
fi
# checking for ocamlc.opt
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLC=$OCAMLCDOTOPT
fi
fi
# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
if test "$OCAMLOPTDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVER" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
fi
# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep.)
fi
AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex.)
else
AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
if test "$OCAMLLEXDOTOPT" != no ; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
fi
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc.)
fi
AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
# platform
AC_MSG_CHECKING(platform)
if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then
AC_MSG_RESULT(Win32)
OCAMLWIN32=yes
EXE=.exe
else
OCAMLWIN32=no
EXE=
fi
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLWEB)
AC_SUBST(OCAMLWIN32)
AC_SUBST(EXE)
# Finally create the Makefile from Makefile.in
AC_OUTPUT(Makefile)
chmod a-w Makefile
#
# autoconf input for Objective Caml programs
# Copyright (C) 2001 Jean-Christophe Fillitre
# from a first script by Georges Mariano
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU Library General Public License version 2 for more details
# (enclosed in the file LGPL).
# the script generated by autoconf from this input will set the following
# variables:
# OCAMLC "ocamlc" if present in the path, or a failure
# or "ocamlc.opt" if present with same version number as ocamlc
# OCAMLOPT "ocamlopt" (or "ocamlopt.opt" if present), or "no"
# OCAMLBEST either "byte" if no native compiler was found,
# or "opt" otherwise
# OCAMLDEP "ocamldep"
# OCAMLLEX "ocamllex" (or "ocamllex.opt" if present)
# OCAMLYACC "ocamlyac"
# OCAMLLIB the path to the ocaml standard library
# OCAMLVERSION the ocaml version number
# OCAMLWEB "ocamlweb" (not mandatory)
# OCAMLWIN32 "yes"/"no" depending on Sys.os_type = "Win32"
# EXE ".exe" if OCAMLWIN32=yes, "" otherwise
# check for one particular file of the sources
# ADAPT THE FOLLOWING LINE TO YOUR SOURCES!
AC_INIT(driver/cduce.mli)
# Check for Ocaml compilers
# we first look for ocamlc in the path; if not present, we fail
AC_CHECK_PROG(OCAMLC,ocamlc,ocamlc,no)
if test "$OCAMLC" = no ; then
AC_MSG_ERROR(Cannot find ocamlc.)
fi
# we extract Ocaml version number and library path
OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -v | tail -1 | cut -f 4 -d " "`
echo "ocaml library path is $OCAMLLIB"
# then we look for ocamlopt; if not present, we issue a warning
# if the version is not the same, we also discard it
# we set OCAMLBEST to "opt" or "byte", whether ocamlopt is available or not
AC_CHECK_PROG(OCAMLOPT,ocamlopt,ocamlopt,no)
OCAMLBEST=byte
if test "$OCAMLOPT" = no ; then
AC_MSG_WARN(Cannot find ocamlopt; bytecode compilation only.)
else
AC_MSG_CHECKING(ocamlopt version)
TMPVERSION=`$OCAMLOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt discarded.)
OCAMLOPT=no
else
AC_MSG_RESULT(ok)
OCAMLBEST=opt
fi
fi
# checking for ocamlc.opt
AC_CHECK_PROG(OCAMLCDOTOPT,ocamlc.opt,ocamlc.opt,no)
if test "$OCAMLCDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVERSION=`$OCAMLCDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVERSION" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlc.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLC=$OCAMLCDOTOPT
fi
fi
# checking for ocamlopt.opt
if test "$OCAMLOPT" != no ; then
AC_CHECK_PROG(OCAMLOPTDOTOPT,ocamlopt.opt,ocamlopt.opt,no)
if test "$OCAMLOPTDOTOPT" != no ; then
AC_MSG_CHECKING(ocamlc.opt version)
TMPVER=`$OCAMLOPTDOTOPT -v | sed -n -e 's|.*version *\(.*\)$|\1|p' `
if test "$TMPVER" != "$OCAMLVERSION" ; then
AC_MSG_RESULT(differs from ocamlc; ocamlopt.opt discarded.)
else
AC_MSG_RESULT(ok)
OCAMLOPT=$OCAMLOPTDOTOPT
fi
fi
fi
# ocamldep, ocamllex and ocamlyacc should also be present in the path
AC_CHECK_PROG(OCAMLDEP,ocamldep,ocamldep,no)
if test "$OCAMLDEP" = no ; then
AC_MSG_ERROR(Cannot find ocamldep.)
fi
AC_CHECK_PROG(OCAMLLEX,ocamllex,ocamllex,no)
if test "$OCAMLLEX" = no ; then
AC_MSG_ERROR(Cannot find ocamllex.)
else
AC_CHECK_PROG(OCAMLLEXDOTOPT,ocamllex.opt,ocamllex.opt,no)
if test "$OCAMLLEXDOTOPT" != no ; then
OCAMLLEX=$OCAMLLEXDOTOPT
fi
fi
AC_CHECK_PROG(OCAMLYACC,ocamlyacc,ocamlyacc,no)
if test "$OCAMLYACC" = no ; then
AC_MSG_ERROR(Cannot find ocamlyacc.)
fi
AC_CHECK_PROG(OCAMLWEB,ocamlweb,ocamlweb,true)
# platform
AC_MSG_CHECKING(platform)
if echo "let _ = Sys.os_type" | ocaml | grep -q Win32; then
AC_MSG_RESULT(Win32)
OCAMLWIN32=yes
EXE=.exe
else
OCAMLWIN32=no
EXE=
fi
# substitutions to perform
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLLEX)
AC_SUBST(OCAMLYACC)
AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
AC_SUBST(OCAMLWEB)
AC_SUBST(OCAMLWIN32)
AC_SUBST(EXE)
# Finally create the Makefile from Makefile.in
AC_OUTPUT(Makefile)
AC_OUTPUT(Makefile.distrib)
chmod a-w Makefile
chmod a-w Makefile.distrib
\ No newline at end of file
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