1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
### Configuration section
# The name of the Zlib library. Usually -lz
ZLIB_LIB=-lz
# The directory containing the Zlib library (libz.a or libz.so)
ZLIB_LIBDIR=/usr/lib
# The directory containing the Zlib header file (zlib.h)
ZLIB_INCLUDE=/usr/include
# Where to install the library. By default: sub-directory 'zip' of
# OCaml's standard library directory.
INSTALLDIR=`$(OCAMLC) -where`/zip
### End of configuration section
OCAMLC=ocamlc -g
OCAMLOPT=ocamlopt
OCAMLDEP=ocamldep
OCAMLMKLIB=ocamlmklib
OBJS=zlib.cmo zip.cmo gzip.cmo
C_OBJS=zlibstubs.o
all: libcamlzip.a zip.cma
allopt: libcamlzip.a zip.cmxa
zip.cma: $(OBJS)
$(OCAMLMKLIB) -o zip -oc camlzip $(OBJS) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
zip.cmxa: $(OBJS:.cmo=.cmx)
$(OCAMLMKLIB) -o zip -oc camlzip $(OBJS:.cmo=.cmx) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
libcamlzip.a: $(C_OBJS)
$(OCAMLMKLIB) -oc camlzip $(C_OBJS) \
-L$(ZLIB_LIBDIR) $(ZLIB_LIB)
.SUFFIXES: .mli .ml .cmo .cmi .cmx
.mli.cmi:
$(OCAMLC) -c $<
.ml.cmo:
$(OCAMLC) -c $<
.ml.cmx:
$(OCAMLOPT) -c $<
.c.o:
$(OCAMLC) -c -ccopt -g -ccopt -I$(ZLIB_INCLUDE) $<
clean:
rm -f *.cm*
rm -f *.o *.a
install:
mkdir -p $(INSTALLDIR)
cp zip.cma zip.cmi gzip.cmi zip.mli gzip.mli libcamlzip.a $(INSTALLDIR)
if test -f dllcamlzip.so; then \
cp dllcamlzip.so $(INSTALLDIR); \
ldconf=`$(OCAMLC) -where`/ld.conf; \
installdir=$(INSTALLDIR); \
if test `grep -s -c $$installdir'$$' $$ldconf || :` = 0; \
then echo $$installdir >> $$ldconf; fi \
fi
installopt:
cp zip.cmxa zip.a zip.cmx gzip.cmx $(INSTALLDIR)
depend:
gcc -MM -I$(ZLIB_INCLUDE) *.c > .depend
ocamldep *.mli *.ml >> .depend
include .depend
|