1 # Interface to Perl from OCaml.
2 # Copyright (C) 2003 Merjis Ltd.
3 # $Id: Makefile,v 1.6 2003-10-12 17:33:14 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)
22 wrappers/pl_HTML_Element.cmo \
23 wrappers/pl_HTML_Parser.cmo \
24 wrappers/pl_HTML_TreeBuilder.cmo \
26 wrappers/pl_HTTP_Message.cmo \
27 wrappers/pl_HTTP_Request.cmo \
28 wrappers/pl_HTTP_Response.cmo \
29 wrappers/pl_LWP_UserAgent.cmo
31 all: perl.cma perl.cmxa perl_init.cmo perl_init.cmx all-examples
33 perl.cma: perl.cmo perl_c.o $(WRAPPERS)
34 $(OCAMLMKLIB) -o perl $^ -lperl
36 perl.cmxa: perl.cmx perl_c.o $(WRAPPERS:.cmo=.cmx)
37 $(OCAMLMKLIB) -o perl $^ -lperl
39 all-examples: examples/test examples/loadpage
41 examples/test: examples/test.cmo
42 $(OCAMLC) $(OCAMLCFLAGS) perl.cma perl_init.cmo $^ -o $@
44 #examples/test.opt: examples/test.cmx
45 # $(OCAMLOPT) $(OCAMLOPTFLAGS) perl.cmxa perl_init.cmx $^ -o $@
47 examples/loadpage: examples/loadpage.cmo
48 $(OCAMLC) $(OCAMLCFLAGS) perl.cma perl_init.cmo $^ -o $@
50 #examples/loadpage.opt: examples/loadpage.cmx
51 # $(OCAMLOPT) $(OCAMLOPTFLAGS) perl.cmxa perl_init.cmx $^ -o $@
54 $(OCAMLC) $(OCAMLCFLAGS) -c $<
57 $(OCAMLC) $(OCAMLCFLAGS) -c $<
60 $(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<
62 .SUFFIXES: .mli .ml .cmi .cmo .cmx
66 JUNKFILES = core *~ *.bak *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so
69 rm -f examples/test examples/loadpage
70 for d in . examples wrappers; do (cd $$d; rm -f $(JUNKFILES)); done
74 ifeq ($(wildcard .depend),.depend)
80 .depend: $(wildcard *.ml) $(wildcard *.mli) $(wildcard examples/*.ml) \
81 $(wildcard wrappers/*.ml)
82 $(OCAMLDEP) $(OCAMLCINCS) *.mli *.ml examples/*.ml wrappers/*.ml \
88 install -c -m 0755 -d $(OCAMLLIBDIR)
89 install -c -m 0755 -d $(OCAMLLIBDIR)/stublibs
90 install -c -m 0644 perl.cmi perl.mli perl.cma perl.cmxa $(OCAMLLIBDIR)
91 install -c -m 0644 perl_init.cmo perl_init.cmx $(OCAMLLIBDIR)
92 install -c -m 0644 perl.a libperl.a $(OCAMLLIBDIR)
93 install -c -m 0644 dllperl.so $(OCAMLLIBDIR)/stublibs
98 rm -rf $(PACKAGE)-$(VERSION)
99 mkdir $(PACKAGE)-$(VERSION)
100 tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
101 tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
102 rm -rf $(PACKAGE)-$(VERSION)
103 ls -l $(PACKAGE)-$(VERSION).tar.gz
106 @for d in `find -type d -name CVS`; \
109 awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
110 sed -e "s|^|$$b|" -e "s|^\./||"; \
111 done | sort > .check-manifest; \
112 sort MANIFEST > .orig-manifest; \
113 diff -u .orig-manifest .check-manifest; \
114 rm -f .orig-manifest .check-manifest
116 .PHONY: depend dist check-manifest