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
|
CAMLSTDLIB=`ocamlc -where`
DESTDIR=$(CAMLSTDLIB)/agrep
OCAMLC=ocamlc -g
OCAMLOPT=ocamlopt
OCAMLMKLIB=ocamlmklib
OCAMLDEP=ocamldep
CFLAGS=-O -D_XOPEN_SOURCE=500
C_OBJS=engine.o
CAML_OBJS=agrep.cmo
all: libagrep.a agrep.cma agrep.cmxa
agrep.cma: $(CAML_OBJS)
$(OCAMLMKLIB) -o agrep $(CAML_OBJS)
agrep.cmxa: $(CAML_OBJS:.cmo=.cmx)
$(OCAMLMKLIB) -o agrep $(CAML_OBJS:.cmo=.cmx)
libagrep.a: $(C_OBJS)
$(OCAMLMKLIB) -o agrep $(C_OBJS)
install:
mkdir -p $(DESTDIR)
cp agrep.cmi agrep.cma agrep.cmxa $(DESTDIR)
cp libagrep.a $(DESTDIR)
if test -f dllagrep.so; then cp dllagrep.so $(DESTDIR); fi
destdir=$(DESTDIR); ldconf=$(CAMLSTDLIB)/ld.conf; \
if test `grep -s -c '^'$$destdir'$$' $$ldconf || :` = 0; \
then echo $$destdir >> $$ldconf; fi
testagrep: testagrep.ml agrep.cma libagrep.a
$(OCAMLC) -I . -custom -o $@ agrep.cma testagrep.ml
clean::
rm -f testagrep
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.mli.cmi:
$(OCAMLC) -c $<
.ml.cmo:
$(OCAMLC) -c $<
.ml.cmx:
$(OCAMLOPT) -c $<
.c.o:
$(OCAMLC) -ccopt "$(CFLAGS)" -c $<
clean::
rm -f *.cm* *.o *.a *.so
depend:
$(OCAMLDEP) *.ml *.mli > .depend
engine.o: skeleton.h
include .depend
|