1 # Interface to Perl from OCaml.
2 # Copyright (C) 2003 Merjis Ltd.
3 # $Id: Makefile,v 1.8 2003-10-15 08:55:23 rich Exp $
5 include Makefile.config
9 OCAMLMKLIB := ocamlmklib
12 OCAMLCINCS := -I wrappers
13 OCAMLOPTINCS := $(OCAMLCINCS)
15 OCAMLCFLAGS := -w s -g $(OCAMLCINCS)
16 OCAMLOPTFLAGS := -w s $(OCAMLOPTINCS)
19 CFLAGS := -Wall -Wno-unused -I$(PERLINCDIR)
21 LIBPERL := $(shell perl -MExtUtils::Embed -e ldopts)
24 wrappers/pl_Net_Google_Cache.cmo \
25 wrappers/pl_Net_Google_Response.cmo \
26 wrappers/pl_Net_Google_Search.cmo \
27 wrappers/pl_Net_Google_Spelling.cmo \
28 wrappers/pl_Net_Google.cmo \
29 wrappers/pl_HTML_Element.cmo \
30 wrappers/pl_HTML_Parser.cmo \
31 wrappers/pl_HTML_TreeBuilder.cmo \
33 wrappers/pl_HTTP_Message.cmo \
34 wrappers/pl_HTTP_Request.cmo \
35 wrappers/pl_HTTP_Response.cmo \
36 wrappers/pl_LWP_UserAgent.cmo
38 all: perl.cma perl.cmxa perl_init.cmo perl_init.cmx all-examples
40 perl.cma: perl.cmo perl_c.o $(WRAPPERS)
41 $(OCAMLMKLIB) -o perl $(LIBPERL) $^
43 perl.cmxa: perl.cmx perl_c.o $(WRAPPERS:.cmo=.cmx)
44 $(OCAMLMKLIB) -o perl $(LIBPERL) $^
46 all-examples: examples/test examples/loadpage examples/google
48 examples/test: examples/test.cmo
49 $(OCAMLC) $(OCAMLCFLAGS) perl.cma perl_init.cmo $^ -o $@
51 #examples/test.opt: examples/test.cmx
52 # $(OCAMLOPT) $(OCAMLOPTFLAGS) perl.cmxa perl_init.cmx $^ -o $@
54 examples/loadpage: examples/loadpage.cmo
55 $(OCAMLC) $(OCAMLCFLAGS) perl.cma perl_init.cmo $^ -o $@
57 #examples/loadpage.opt: examples/loadpage.cmx
58 # $(OCAMLOPT) $(OCAMLOPTFLAGS) perl.cmxa perl_init.cmx $^ -o $@
60 examples/google: examples/google.cmo
61 $(OCAMLC) $(OCAMLCFLAGS) perl.cma perl_init.cmo $^ -o $@
63 #examples/google.opt: examples/google.cmx
64 # $(OCAMLOPT) $(OCAMLOPTFLAGS) perl.cmxa perl_init.cmx $^ -o $@
67 $(OCAMLC) $(OCAMLCFLAGS) -c $<
70 $(OCAMLC) $(OCAMLCFLAGS) -c $<
73 $(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<
75 .SUFFIXES: .mli .ml .cmi .cmo .cmx
79 JUNKFILES = core *~ *.bak *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
82 rm -f examples/test examples/loadpage examples/google
83 for d in . examples wrappers; do (cd $$d; rm -f $(JUNKFILES)); done
87 ifeq ($(wildcard .depend),.depend)
93 .depend: $(wildcard *.ml) $(wildcard *.mli) $(wildcard examples/*.ml) \
94 $(wildcard wrappers/*.ml)
95 $(OCAMLDEP) $(OCAMLCINCS) *.mli *.ml examples/*.ml wrappers/*.ml \
101 install -c -m 0755 -d $(OCAMLLIBDIR)/perl
102 install -c -m 0755 -d $(OCAMLLIBDIR)/stublibs
103 install -c -m 0644 perl.cmi perl.mli perl.cma perl.cmxa \
104 perl_init.cmo perl_init.cmx perl.a libperl.a \
105 $(WRAPPERS:.cmo=.ml) $(WRAPPERS:.cmo=.cmi) $(OCAMLLIBDIR)/perl
106 install -c -m 0644 dllperl.so $(OCAMLLIBDIR)/stublibs
111 rm -rf $(PACKAGE)-$(VERSION)
112 mkdir $(PACKAGE)-$(VERSION)
113 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
114 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
115 rm -rf $(PACKAGE)-$(VERSION)
116 ls -l $(PACKAGE)-$(VERSION).tar.gz
119 @for d in `find -type d -name CVS`; \
122 awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
123 sed -e "s|^|$$b|" -e "s|^\./||"; \
124 done | sort > .check-manifest; \
125 sort MANIFEST > .orig-manifest; \
126 diff -u .orig-manifest .check-manifest; \
127 rm -f .orig-manifest .check-manifest
129 .PHONY: depend dist check-manifest