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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
# make all: make bytecode archive
# make opt: make native archive
# make install: install bytecode archive, and if present, native archive
# make uninstall: uninstall package
# make clean: remove intermediate files
# make distclean: remove any superflous files
# make release: cleanup, create archive, tag CVS module
# (for developers)
#----------------------------------------------------------------------
# specific rules for this package:
OBJECTS = netstring_str.cmo netdate.cmo \
netencoding.cmo netbuffer.cmo netstream.cmo \
mimestring.cmo cgi.cmo base64.cmo \
nethtml_scanner.cmo nethtml.cmo \
neturl.cmo \
netmappings.cmo netconversion.cmo
XOBJECTS = $(OBJECTS:.cmo=.cmx)
ARCHIVE = netstring.cma
XARCHIVE = netstring.cmxa
NAME = netstring
REQUIRES = str
ISO_MAPPINGS = mappings/iso*.unimap
OTHER_MAPPINGS = mappings/cp*.unimap \
mappings/adobe*.unimap \
mappings/jis*.unimap \
mappings/koi*.unimap \
mappings/mac*.unimap \
mappings/windows*.unimap
all: $(ARCHIVE) \
netstring_top.cmo netstring_mt.cmo \
netmappings_iso.cmo netmappings_other.cmo
opt: $(XARCHIVE) \
netstring_mt.cmx \
netmappings_iso.cmx netmappings_other.cmx
$(ARCHIVE): $(OBJECTS)
$(OCAMLC) -a -o $(ARCHIVE) $(OBJECTS)
$(XARCHIVE): $(XOBJECTS)
$(OCAMLOPT) -a -o $(XARCHIVE) $(XOBJECTS)
netmappings_iso.ml:
$(MAKE) -C tools
test ! -d mappings || tools/unimap_to_ocaml/unimap_to_ocaml \
-o netmappings_iso.ml $(ISO_MAPPINGS)
netmappings_other.ml:
$(MAKE) -C tools
test ! -d mappings || tools/unimap_to_ocaml/unimap_to_ocaml \
-o netmappings_other.ml $(OTHER_MAPPINGS)
#----------------------------------------------------------------------
# general rules:
OPTIONS =
OCAMLC = ocamlc $(DEBUG) $(OPTIONS) $(ROPTIONS)
OCAMLOPT = ocamlopt $(OPTIONS) $(ROPTIONS)
OCAMLLEX = ocamllex
OCAMLDEP = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind
DEBUG =
# Invoke with: make DEBUG=-g
depend: *.ml *.mli
$(OCAMLDEP) *.ml *.mli >depend
depend.pkg: Makefile
$(OCAMLFIND) use -p ROPTIONS= $(REQUIRES) >depend.pkg
.PHONY: install
install: all
{ test ! -f $(XARCHIVE) || extra="*.cmxa *.a netstring_mt.cmx netmappings_iso.cmx netmappings_other.cmx netstring_mt.o netmappings_iso.o netmappings_other.o"; }; \
$(OCAMLFIND) install -destdir $(DESTDIR) $(NAME) *.mli *.cmi *.cma netstring_top.cmo netstring_mt.cmo netmappings_iso.cmo netmappings_other.cmo META $$extra
.PHONY: install-cgi
install-cgi:
$(OCAMLFIND) install -destdir $(DESTDIR) cgi compat-cgi/META
.PHONY: install-base64
install-base64:
$(OCAMLFIND) install -destdir $(DESTDIR) base64 compat-base64/META
.PHONY: uninstall
uninstall:
$(OCAMLFIND) remove $(NAME)
.PHONY: uninstall-cgi
uninstall-cgi:
$(OCAMLFIND) remove cgi
.PHONY: uninstall-base64
uninstall-base64:
$(OCAMLFIND) remove base64
.PHONY: clean
clean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
test ! -d mappings || rm -f netmappings_iso.ml netmappings_other.ml
.PHONY: distclean
distclean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
rm -f *~ depend depend.pkg compat-cgi/*~ compat-base64/*~
$(MAKE) -C tests distclean
$(MAKE) -C doc distclean
$(MAKE) -C tools distclean
RELEASE: META
awk '/version/ { print substr($$3,2,length($$3)-2) }' META >RELEASE
.PHONY: dist
dist: RELEASE
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)
.PHONY: tag-release
tag-release: RELEASE
r=`head -1 RELEASE | sed -e s/\\\./-/g`; cd ..; cvs tag -F $(NAME)-$$r $(NAME)
.PHONY: release
release: distclean
test -f netmappings_iso.ml
test -f netmappings_other.ml
$(MAKE) tag-release
$(MAKE) dist
.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll
.ml.cmx:
$(OCAMLOPT) -c -thread $<
.ml.cmo:
$(OCAMLC) -g -c -thread $<
.mli.cmi:
$(OCAMLC) -c $<
.mll.ml:
$(OCAMLLEX) $<
include depend
include depend.pkg
|