OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread
OCAMLC = ocamlfind ocamlc $(OCAMLOPTIONS)
OCAMLOPT = ocamlfind ocamlopt $(OCAMLOPTIONS)
+EXECUTABLES = uriSetQueue drawGraph
+EXECUTABLES_OPT = $(patsubst %,%.opt,$(EXECUTABLES))
#OBJS=prova.$(PID).svg prova.$(PID).ps prova.$(PID).gif prova.$(PID).ismap prova.$(PID).imap prova.$(PID).html
OBJS=prova.$(PID).gif prova.$(PID).ismap prova.$(PID).html
-all: $(OBJS)
+all: $(EXECUTABLES)
+opt: $(EXECUTABLES_OPT)
+world: all opt
+clean:
+ rm -f *.cm[aiox] *.cmxa *.[ao] $(EXECUTABLES) $(EXECUTABLES_OPT)
+
+tmp: $(OBJS)
+clean_tmp:
+ rm -f $(OBJS) prova.$(PID).dot xx.$(PID)00 xx.$(PID)01 xx.$(PID)02 \
+ xx.$(PID)02n xx.$(PID)03 log.$(PID)
uriSetQueue: uriSetQueue.ml
$(OCAMLC) -linkpkg -o $@ $<
$(OCAMLOPT) -linkpkg -o $@ $<
drawGraph: drawGraph.ml
- $(OCAMLC) -package "unix netclient" -linkpkg -o $@ $<
+ $(OCAMLC) -linkpkg -o $@ $<
drawGraph.opt: drawGraph.ml
- $(OCAMLOPT) -package "unix netclient" -linkpkg -o $@ $<
+ $(OCAMLOPT) -linkpkg -o $@ $<
prova.$(PID).dot: prova0.$(PID).dot
csplit --prefix=xx.$(PID) prova0.$(PID).dot 1 2 `expr \`wc -l prova0.$(PID).dot | sed 's/\([0123456789]\+\) prova0.$(PID).dot/\1/'\` + 1`
prova.$(PID).html: prova.$(PID).ismap
cat xx.$(PID)00 prova.$(PID).ismap | ./mk_html.pl $(PID) > prova.$(PID).html
-clean:
- rm -f $(OBJS) prova.$(PID).dot xx.$(PID)00 xx.$(PID)01 xx.$(PID)02 xx.$(PID)02n xx.$(PID)03 log.$(PID)
let wget url fname =
prerr_endline (sprintf "DEBUG: wgetting url '%s'" url);
- let data = Http_client.Convenience.http_get url in
let oc = open_out fname in
- output_string oc data;
+ Http_client.http_get_iter (output_string oc) url;
close_out oc
;;
let url = req#param "url" in
let pid = Unix.getpid () in
wget (sprintf "%s¶m.PID=%d" url pid) (sprintf "prova0.%d.dot" pid);
- (match Unix.system (sprintf "make PID=%d > log.%d" pid pid) with
+ (match Unix.system (sprintf "make tmp PID=%d > log.%d" pid pid) with
| Unix.WEXITED 0 ->
debug_print "HTML successfully generated";
Http_daemon.respond_file (sprintf "prova.%d.html" pid) outchan
let pid = req#param "pid" in
Http_daemon.respond_file (sprintf "prova.%s.gif" pid) outchan;
ignore (Unix.system (
- sprintf "make PID=%s clean; rm -f prova0.%s.dot" pid pid))
+ sprintf "make PID=%s clean_tmp; rm -f prova0.%s.dot" pid pid))
| invalid_request ->
Http_daemon.respond_error ~status:(`Client_error `Bad_request) outchan)
with