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
|
# 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 = http_client.cmo telnet_client.cmo
#ftp_data_endpoint.cmo
XOBJECTS = $(OBJECTS:.cmo=.cmx)
ARCHIVE = netclient.cma
XARCHIVE = netclient.cmxa
MTARCHIVE = netclient_mt.cma
MTXARCHIVE = netclient_mt.cmxa
NAME = netclient
REQUIRES = unix equeue netstring
BYTE_THREAD = -vmthread
NAT_THREAD = -thread
all: $(ARCHIVE) $(MTARCHIVE)
non_mt: $(ARCHIVE)
opt: $(XARCHIVE) $(MTXARCHIVE)
non_mt_opt: $(XARCHIVE)
$(ARCHIVE): $(OBJECTS) non_mt/http_client_aux.cmo
$(OCAMLC) -a -o $(ARCHIVE) non_mt/http_client_aux.cmo $(OBJECTS)
$(XARCHIVE): $(XOBJECTS) non_mt/http_client_aux.cmx
$(OCAMLOPT) -a -o $(XARCHIVE) non_mt/http_client_aux.cmx $(XOBJECTS)
$(MTARCHIVE): $(OBJECTS) mt/http_client_aux.cmo
$(OCAMLC) -a -o $(MTARCHIVE) mt/http_client_aux.cmo $(OBJECTS)
$(MTXARCHIVE): $(XOBJECTS) mt/http_client_aux.cmx
$(OCAMLOPT) -a -o $(MTXARCHIVE) mt/http_client_aux.cmx $(XOBJECTS)
#http_client.cmo: mt/http_client_aux.cmo non_mt/http_client_aux.cmo
#http_client.cmx: mt/http_client_aux.cmx non_mt/http_client_aux.cmx
mt/http_client_aux.cmo: mt/http_client_aux.ml http_client_aux.cmi
cp http_client_aux.cmi http_client_aux.mli mt
$(OCAMLC) -package xstr $(BYTE_THREAD) -c mt/http_client_aux.ml
mt/http_client_aux.cmx: mt/http_client_aux.ml http_client_aux.cmi
cp http_client_aux.cmi http_client_aux.mli mt
$(OCAMLOPT) -package xstr $(NAT_THREAD) -c mt/http_client_aux.ml
non_mt/http_client_aux.cmo: non_mt/http_client_aux.ml http_client_aux.cmi
cp http_client_aux.cmi http_client_aux.mli non_mt
$(OCAMLC) -c non_mt/http_client_aux.ml
non_mt/http_client_aux.cmx: non_mt/http_client_aux.ml http_client_aux.cmi
cp http_client_aux.cmi http_client_aux.mli non_mt
$(OCAMLOPT) -c non_mt/http_client_aux.ml
testmt: testmt.ml netclient_mt.cma
ocamlfind ocamlc -package "$(REQUIRES)" -package xstr,threads \
-predicates mt_posix \
-linkpkg $(BYTE_THREAD) -custom netclient_mt.cma testmt.ml \
-o testmt
#----------------------------------------------------------------------
# general rules:
OPTIONS =
OCAMLC = ocamlfind ocamlc -g $(OPTIONS) -package "$(REQUIRES)"
OCAMLOPT = ocamlfind ocamlopt $(OPTIONS) -package "$(REQUIRES)"
OCAMLDEP = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind
depend: *.ml *.mli
#$(OCAMLDEP) *.ml *.mli >depend
$(OCAMLDEP) http_client.ml http_client.mli \
telnet_client.ml telnet_client.mli \
http_client_aux.mli >depend
.PHONY: install
install: all
{ test ! -f $(XARCHIVE) -a ! -f $(MTXARCHIVE) || extra="*.cmxa *.a"; }; \
$(OCAMLFIND) install -destdir $(DESTDIR) $(NAME) *.mli *.cmi *.cma META $$extra
.PHONY: uninstall
uninstall:
$(OCAMLFIND) remove $(NAME)
.PHONY: clean
clean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
cd mt; rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
cd non_mt; rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
rm -f mt/http_client_aux.mli non_mt/http_client_aux.mli
[ ! -d tests ] || $(MAKE) -C tests clean
.PHONY: distclean
distclean: clean
rm -f *~ depend depend.pkg
cd mt; rm -f *~
cd non_mt; rm -f *~
$(MAKE) -C tests distclean
$(MAKE) -C tests_std distclean
$(MAKE) -C examples/spider distclean
$(MAKE) -C examples/telnet_labltk 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" $(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
$(MAKE) tag-release
$(MAKE) dist
.ml.cmx:
$(OCAMLOPT) -c $<
.ml.cmo:
$(OCAMLC) -c $<
.mli.cmi:
$(OCAMLC) -c $<
.SUFFIXES: .cmo .cmi .cmx .ml .mli
include depend
|