X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Makefile;h=e852966c6e9a5a6c1f691e4ae82e10dd47d65b53;hb=eeb3c50796f2f080bf2ba2d0787e43395f436392;hp=661564cf760f807e8969f1bc0bad84d31a6ba49e;hpb=918648a5563d9ae8e4079fdf7d364387b02b1b34;p=perl4caml.git diff --git a/Makefile b/Makefile index 661564c..e852966 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Interface to Perl from OCaml. # Copyright (C) 2003 Merjis Ltd. -# $Id: Makefile,v 1.9 2003-10-15 09:49:52 rich Exp $ +# $Id: Makefile,v 1.14 2003-11-02 13:28:38 rich Exp $ include Makefile.config @@ -8,6 +8,7 @@ OCAMLC := ocamlc OCAMLOPT := ocamlopt OCAMLMKLIB := ocamlmklib OCAMLDEP := ocamldep +OCAMLDOC := ocamldoc OCAMLCINCS := -I wrappers OCAMLOPTINCS := $(OCAMLCINCS) @@ -20,6 +21,15 @@ CFLAGS := -Wall -Wno-unused -I$(PERLINCDIR) LIBPERL := $(shell perl -MExtUtils::Embed -e ldopts) +SED := sed + +# XXX Hack required by ocamlopt, and sometimes ocamlc. +# To work out what this should be, try: +# `perl -MExtUtils::Embed -e ldopts' +DYNALOADER_HACK := /usr/lib/perl/5.8.1/auto/DynaLoader/DynaLoader.a + +OCAMLDOCFLAGS := -html -stars -sort $(OCAMLCINCS) + WRAPPERS := \ wrappers/pl_Net_Google_Cache.cmo \ wrappers/pl_Net_Google_Response.cmo \ @@ -35,7 +45,7 @@ WRAPPERS := \ wrappers/pl_HTTP_Response.cmo \ wrappers/pl_LWP_UserAgent.cmo -all: perl4caml.cma perl4caml.cmxa perl_init.cmo perl_init.cmx all-examples +all: perl4caml.cma perl4caml.cmxa META all-examples html perl4caml.cma: perl.cmo perl_c.o $(WRAPPERS) $(OCAMLMKLIB) -o perl4caml $(LIBPERL) $^ @@ -43,25 +53,29 @@ perl4caml.cma: perl.cmo perl_c.o $(WRAPPERS) perl4caml.cmxa: perl.cmx perl_c.o $(WRAPPERS:.cmo=.cmx) $(OCAMLMKLIB) -o perl4caml $(LIBPERL) $^ -all-examples: examples/test examples/loadpage examples/google +all-examples: examples/test examples/loadpage examples/google \ + examples/test.opt examples/loadpage.opt examples/google.opt examples/test: examples/test.cmo - $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma perl_init.cmo $^ -o $@ + $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma $^ -o $@ -#examples/test.opt: examples/test.cmx -# $(OCAMLOPT) $(OCAMLOPTFLAGS) perl4caml.cmxa perl_init.cmx $^ -o $@ +examples/test.opt: examples/test.cmx + $(OCAMLOPT) $(OCAMLOPTFLAGS) -cclib -L. perl4caml.cmxa \ + $(DYNALOADER_HACK) $^ -o $@ examples/loadpage: examples/loadpage.cmo - $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma perl_init.cmo $^ -o $@ + $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma $^ -o $@ -#examples/loadpage.opt: examples/loadpage.cmx -# $(OCAMLOPT) $(OCAMLOPTFLAGS) perl4caml.cmxa perl_init.cmx $^ -o $@ +examples/loadpage.opt: examples/loadpage.cmx + $(OCAMLOPT) $(OCAMLOPTFLAGS) -cclib -L. perl4caml.cmxa \ + $(DYNALOADER_HACK) $^ -o $@ examples/google: examples/google.cmo - $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma perl_init.cmo $^ -o $@ + $(OCAMLC) $(OCAMLCFLAGS) perl4caml.cma $^ -o $@ -#examples/google.opt: examples/google.cmx -# $(OCAMLOPT) $(OCAMLOPTFLAGS) perl4caml.cmxa perl_init.cmx $^ -o $@ +examples/google.opt: examples/google.cmx + $(OCAMLOPT) $(OCAMLOPTFLAGS) -cclib -L. perl4caml.cmxa \ + $(DYNALOADER_HACK) $^ -o $@ %.cmi: %.mli $(OCAMLC) $(OCAMLCFLAGS) -c $< @@ -74,12 +88,17 @@ examples/google: examples/google.cmo .SUFFIXES: .mli .ml .cmi .cmo .cmx +META: META.in Makefile.config + $(SED) -e 's/@PACKAGE@/$(PACKAGE)/' \ + -e 's/@VERSION@/$(VERSION)/' \ + < $< > $@ + # Clean. JUNKFILES = core *~ *.bak *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so clean: - rm -f examples/test examples/loadpage examples/google + rm -f META examples/test examples/loadpage examples/google for d in . examples wrappers; do (cd $$d; rm -f $(JUNKFILES)); done # Build dependencies. @@ -98,12 +117,14 @@ depend: .depend # Install. install: - install -c -m 0755 -d $(OCAMLLIBDIR)/perl - install -c -m 0755 -d $(OCAMLLIBDIR)/stublibs + rm -rf $(DESTDIR)$(OCAMLLIBDIR)/perl + install -c -m 0755 -d $(DESTDIR)$(OCAMLLIBDIR)/perl + install -c -m 0755 -d $(DESTDIR)$(OCAMLLIBDIR)/stublibs install -c -m 0644 perl.cmi perl.mli perl4caml.cma perl4caml.cmxa \ - perl_init.cmo perl_init.cmx perl4caml.a libperl4caml.a \ - $(WRAPPERS:.cmo=.ml) $(WRAPPERS:.cmo=.cmi) $(OCAMLLIBDIR)/perl - install -c -m 0644 dllperl4caml.so $(OCAMLLIBDIR)/stublibs + perl4caml.a libperl4caml.a META \ + $(WRAPPERS:.cmo=.ml) $(WRAPPERS:.cmo=.cmi) \ + $(DESTDIR)$(OCAMLLIBDIR)/perl + install -c -m 0644 dllperl4caml.so $(DESTDIR)$(OCAMLLIBDIR)/stublibs # Distribution. @@ -126,4 +147,13 @@ check-manifest: diff -u .orig-manifest .check-manifest; \ rm -f .orig-manifest .check-manifest -.PHONY: depend dist check-manifest \ No newline at end of file +# Documentation. + +html: html/index.html + +html/index.html: $(wildcard *.ml) $(wildcard *.mli) $(wildcard wrappers/*.ml) + rm -rf html + mkdir html + -$(OCAMLDOC) $(OCAMLDOCFLAGS) -d html $^ + +.PHONY: depend dist check-manifest html \ No newline at end of file