Skip to content

Commit

Permalink
Better Findlib support, v0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
polazarus committed Sep 17, 2010
1 parent 7f8dd7b commit 397d5a3
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 18 deletions.
42 changes: 28 additions & 14 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ YICESL_C_H = $(prefix)/include/yicesl_c.h
DIFF = diff -bu
PATCH = patch

# Ocaml library directories for linking
OCAMLLIB = @OCAMLLIB@
OCAMLDESTDIR = @OCAMLDESTDIR@
OCAMLYICES_LIB_DIR = $(OCAMLDESTDIR)/ocamlyices

OCAML_STUBLIBS = $(OCAMLDESTDIR)/stublibs
# Ocaml library directory where to install this package
OCAMLDESTDIR = @OCAMLDESTDIR@

# Input

CAMLIDL_SOURCE = yices yicesl

# Output

OUTPUT = ocamlyices
OUTPUT = $(PACKAGE_NAME)
OUTPUT_BYTECODE = $(OUTPUT).cma
OUTPUT_NATIVE = $(OUTPUT).cmxa
OUTPUT_NATIVE_LIB = $(OUTPUT_NATIVE:.cmxa=.a)
OUTPUT_NATIVE_LIB = $(OUTPUT).a
OUTPUT_O = $(OUTPUT).o
OUTPUT_LIB = lib$(OUTPUT).a
OUTPUT_DLL = dll$(OUTPUT).so
Expand All @@ -58,6 +58,7 @@ CAMLIDL = @CAMLIDL@
OCAMLC = @OCAMLC@
OCAMLOPT = @OCAMLOPT@
OCAMLDOC = @OCAMLDOC@
OCAMLFIND = @OCAMLFIND@
CC = @CC@
CFLAGS = -O2
AR = ar
Expand Down Expand Up @@ -177,7 +178,7 @@ ifeq ($(PARTIAL_LINKING),no)
else
# Partial linking for efficiency
# For ld, libraries must be after last
$(INCREMENTAL_LINKER) -L$(OCAMLLIB) -o $(OUTPUT_O) $^ $(PLLIBS:%=-l%)
$(INCREMENTAL_LINKER) $(OCAMLLIB:%=-L%) -o $(OUTPUT_O) $^ $(PLLIBS:%=-l%)
$(AR) crs $@ $(OUTPUT_O)
endif

Expand All @@ -186,7 +187,7 @@ $(OUTPUT_BYTECODE): $(CAMLIDL_CMO) $(OUTPUT_LIB)
$(OCAMLC) -a -custom -o $@ -cclib -l$(OUTPUT_LIB:lib%.a=%) $(CCLIBS:%=-cclib -l%) $(CAMLIDL_CMO)
else
$(OUTPUT_DLL): $(CAMLIDL_STUBS_C) yices_extra.c
$(CC) $(CFLAGS) -fPIC -shared -o $@ $^ -L$(OCAMLLIB) -Wl,-Bstatic $(DL_STATIC_LIBS:%=-l%) -Wl,-Bdynamic $(DL_SHARED_LIBS:%=-l%)
$(CC) $(CFLAGS) -fPIC -shared -o $@ $^ $(OCAMLLIB:%=-L%) -Wl,-Bstatic $(DL_STATIC_LIBS:%=-l%) -Wl,-Bdynamic $(DL_SHARED_LIBS:%=-l%)
$(OUTPUT_BYTECODE): $(CAMLIDL_CMO) $(OUTPUT_DLL)
$(OCAMLC) -a -o $@ -dllib -l$(OUTPUT_DLL:dll%.so=%) $(CAMLIDL_CMO)
endif
Expand Down Expand Up @@ -216,20 +217,33 @@ clean:
$(RM) *.cmo *.cmi *.cmx *.a *.o $(CAMLIDL_GENERATED)

distclean mrproper: clean
$(RM) *.cma *.cmxa *.a *.so $(META)
$(RM) *.cma *.cmxa *.a *.so $(META) *.idl

# Install ######################################################################

install:
install -d $(OCAMLYICES_LIB_DIR)
install -t $(OCAMLYICES_LIB_DIR) $(CAMLIDL_CMI) $(OUTPUT_LIB) $(OUTPUT_NATIVE_LIB) $(OUTPUT_BYTECODE) $(OUTPUT_NATIVE) $(META)
INSTALLABLE = $(CAMLIDL_CMI) $(OUTPUT_LIB) $(OUTPUT_NATIVE_LIB) $(OUTPUT_BYTECODE) $(OUTPUT_NATIVE) $(META)
ifeq ($(CUSTOM),no)
install -t $(OCAML_STUBLIBS) $(OUTPUT_DLL)
INSTALLABLE_DLL = $(OUTPUT_DLL)
endif

install:
ifdef OCAMLFIND
$(OCAMLFIND) install ocamlyices $(INSTALLABLE) -dll $(INSTALLABLE_DLL)
else
install -d $(OCAMLDESTDIR)/$(PACKAGE_NAME)
install -t $(OCAMLDESTDIR)/$(PACKAGE_NAME) $(INSTALLABLE)
ifdef INSTALLABLE_DLL
install -t $(OCAMLDESTDIR)/stublibs $(OUTPUT_DLL)
endif
endif

uninstall:
$(RM) -r $(OCAMLYICES_LIB_DIR)
$(RM) $(OCAML_STUBLIBS)/$(OUTPUT_DLL)
ifdef OCAMLFIND
$(OCAMLFIND) remove ocamlyices
else
$(RM) -r $(OCAMLDESTDIR)/$(PACKAGE_NAME)
$(RM) $(INSTALLABLE_DLL:%=$(OCAMLDESTDIR)/stublibs/%)
endif

# Makefile and configure #######################################################
Makefile: Makefile.in config.status
Expand Down
1 change: 1 addition & 0 deletions README
17 changes: 15 additions & 2 deletions README.md → README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Ocamlyices: An Ocaml binding for Yices 1, version 0.3
Ocamlyices: An Ocaml binding for Yices 1, version 0.4

Mickaël Delahaye

Expand Down Expand Up @@ -31,6 +31,8 @@ Hardly tested! and only under Linux, but reported to work under MacOS X...
Setup
=====

Warning! Please make sure to uninstall any previous version beforehand.

$ autoconf # Only if there is no configure
$ ./configure
$ make
Expand Down Expand Up @@ -81,8 +83,19 @@ Or without:
ocamlc -I +ocamlyices nums.cma ocamlyices.cma ...
ocamlopt -I +ocamlyices nums.cmxa ocamlyices.cmxa ...

nums is required in order to handle GMP big integers as big_int.
_nums_ is required in order to handle GMP big integers as big_int.

Doc
-------

A very limited ocamldoc is avalaible in `doc/` provided you run this command:

$ make doc

For the rest, see the official documentation at
http://yices.csl.sri.com/capi.shtml

Also, three examples are also avalaible in `examples/`.

Uninstall
=========
Expand Down
16 changes: 14 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(ocamlyices,0.3)
AC_INIT(ocamlyices,0.4)

AC_PROG_CC
AC_PROG_RANLIB
Expand All @@ -13,7 +13,17 @@ echo "ocaml version is $OCAMLVERSION"
OCAMLLIB=`$OCAMLC -where`
echo "ocaml library path is $OCAMLLIB"

OCAMLDESTDIR=$OCAMLLIB

AC_CHECK_PROG(OCAMLFIND,ocamlfind,ocamlfind,)
if test "x$OCAMLFIND" = "x" ; then
AC_MSG_WARN(Cannot find ocamlfind. Use only the standard Ocaml library directory.)
OCAMLDESTDIR=$OCAMLLIB
else
OCAMLDESTDIR=`$OCAMLFIND printconf destdir`
if test "$OCAMLDESTDIR" != "$OCAMLLIB"; then
OCAMLLIB="$OCAMLLIB $OCAMLDESTDIR"
fi
fi
AC_ARG_WITH(destdir,[AS_HELP_STRING([--with-destdir=destdir],[force a dest dir])],[OCAMLDESTDIR=$with_destdir],[])


Expand Down Expand Up @@ -142,6 +152,8 @@ AC_SUBST(CAMLIDL)
AC_SUBST(OCAMLOPT)
AC_SUBST(OCAMLDOC)
AC_SUBST(OCAMLDEP)
AC_SUBST(OCAMLFIND)

AC_SUBST(OCAMLBEST)
AC_SUBST(OCAMLVERSION)
AC_SUBST(OCAMLLIB)
Expand Down

0 comments on commit 397d5a3

Please sign in to comment.