1 # make all: make bytecode archive
2 # make opt: make native archive
3 # make install: install bytecode archive, and if present, native archive
4 # make uninstall: uninstall package
5 # make clean: remove intermediate files
6 # make distclean: remove any superflous files
7 # make release: cleanup, create archive, tag CVS module
10 #----------------------------------------------------------------------
11 # specific rules for this package:
13 OBJECTS = netstring_str.cmo \
14 netencoding.cmo netbuffer.cmo netstream.cmo \
15 mimestring.cmo cgi.cmo base64.cmo \
16 nethtml_scanner.cmo nethtml.cmo \
18 netmappings.cmo netconversion.cmo
19 XOBJECTS = $(OBJECTS:.cmo=.cmx)
20 ARCHIVE = netstring.cma
21 XARCHIVE = netstring.cmxa
26 ISO_MAPPINGS = mappings/iso*.unimap
27 OTHER_MAPPINGS = mappings/cp*.unimap \
28 mappings/adobe*.unimap \
29 mappings/jis*.unimap \
30 mappings/koi*.unimap \
31 mappings/mac*.unimap \
32 mappings/windows*.unimap
35 netstring_top.cmo netstring_mt.cmo \
36 netmappings_iso.cmo netmappings_other.cmo
40 netmappings_iso.cmx netmappings_other.cmx
43 $(ARCHIVE): $(OBJECTS)
44 $(OCAMLC) -a -o $(ARCHIVE) $(OBJECTS)
46 $(XARCHIVE): $(XOBJECTS)
47 $(OCAMLOPT) -a -o $(XARCHIVE) $(XOBJECTS)
51 test ! -d mappings || tools/unimap_to_ocaml/unimap_to_ocaml \
52 -o netmappings_iso.ml $(ISO_MAPPINGS)
56 test ! -d mappings || tools/unimap_to_ocaml/unimap_to_ocaml \
57 -o netmappings_other.ml $(OTHER_MAPPINGS)
59 #----------------------------------------------------------------------
63 OCAMLC = ocamlc $(DEBUG) $(OPTIONS) $(ROPTIONS)
64 OCAMLOPT = ocamlopt $(OPTIONS) $(ROPTIONS)
66 OCAMLDEP = ocamldep $(OPTIONS)
70 # Invoke with: make DEBUG=-g
73 $(OCAMLDEP) *.ml *.mli >depend
76 $(OCAMLFIND) use -p ROPTIONS= $(REQUIRES) >depend.pkg
80 { test ! -f $(XARCHIVE) || extra="*.cmxa *.a netstring_mt.cmx netmappings_iso.cmx netmappings_other.cmx netstring_mt.o netmappings_iso.o netmappings_other.o"; }; \
81 $(OCAMLFIND) install $(NAME) *.mli *.cmi *.cma netstring_top.cmo netstring_mt.cmo netmappings_iso.cmo netmappings_other.cmo META $$extra
85 $(OCAMLFIND) install cgi compat-cgi/META
88 .PHONY: install-base64
90 $(OCAMLFIND) install base64 compat-base64/META
95 $(OCAMLFIND) remove $(NAME)
99 $(OCAMLFIND) remove cgi
101 .PHONY: uninstall-base64
103 $(OCAMLFIND) remove base64
107 rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
108 test ! -d mappings || rm -f netmappings_iso.ml netmappings_other.ml
112 rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
113 rm -f *~ depend depend.pkg compat-cgi/*~ compat-base64/*~
114 $(MAKE) -C tests distclean
115 $(MAKE) -C doc distclean
116 $(MAKE) -C tools distclean
119 awk '/version/ { print substr($$3,2,length($$3)-2) }' META >RELEASE
123 r=`head -1 RELEASE`; cd ..; gtar czf $(NAME)-$$r.tar.gz --exclude='*/CVS*' --exclude="*/depend.pkg" --exclude="*/depend" --exclude="*/doc/common.xml" --exclude="*/doc/config.xml" --exclude="*/doc/readme.dtd" --exclude="*/Mail" --exclude="*/mappings" $(NAME)
127 r=`head -1 RELEASE | sed -e s/\\\./-/g`; cd ..; cvs tag -F $(NAME)-$$r $(NAME)
131 test -f netmappings_iso.ml
132 test -f netmappings_other.ml
136 .SUFFIXES: .cmo .cmi .cmx .ml .mli .mll
139 $(OCAMLOPT) -c -thread $<
142 $(OCAMLC) -c -thread $<