Commit 92dd9a78 authored by Andrei Paskevich's avatar Andrei Paskevich

move the server code to a dedicated directory

also, do not use server_main.c, compile both .o instead
parent 6bb5875d
......@@ -121,8 +121,10 @@ why3.conf
/doc/stdlibdoc/
# /lib
/lib/why3-cpulimit
/lib/why3-cpulimit.exe
/lib/why3cpulimit
/lib/why3cpulimit.exe
/lib/why3server
/lib/why3server.exe
# /lib/why3/
/lib/why3/META
......
......@@ -248,7 +248,7 @@ opt: lib/why3/why3.cmxa
lib/why3/why3.cma: lib/why3/why3.cmo
$(if $(QUIET),@echo 'Linking $@' &&) \
$(OCAMLC) -a $(BFLAGS) -o $@ $^
$(OCAMLC) -a $(BFLAGS) -o $@ $^
lib/why3/why3.cmxa: lib/why3/why3.cmx
$(if $(QUIET),@echo 'Linking $@' &&) \
......@@ -614,46 +614,38 @@ clean::
# Why3server #
##############
SERVER_MODULES:= logging arraylist options queue readbuf request writebuf server_main
SERVER_C:= $(addprefix src/tools/, $(addsuffix .c, $(SERVER_MODULES)))
SERVER_H:= $(addprefix src/tools/, $(addsuffix .h, $(SERVER_MODULES)))
SERVER_O:= $(addprefix src/tools/, $(addsuffix .o, $(SERVER_MODULES)))
SERVER_MODULES := logging arraylist options queue readbuf request \
writebuf server-unix server-win
CPULIM_MODULES := cpulimit-unix cpulimit-win
SERVER_O := $(addprefix src/server/, $(addsuffix .o, $(SERVER_MODULES)))
CPULIM_O := $(addprefix src/server/, $(addsuffix .o, $(CPULIM_MODULES)))
opt: lib/why3server$(EXE)
TOOLS = lib/why3server$(EXE) lib/why3cpulimit$(EXE)
byte opt: $(TOOLS)
lib/why3server$(EXE): $(SERVER_O)
gcc -o $@ $^
$(CC) -Wall -o $@ $^
lib/why3cpulimit$(EXE): $(CPULIM_O)
$(CC) -Wall -o $@ $^
%.o: %.c %.h
gcc -c -Wall -g -o $@ $<
%.o: %.c
gcc -c -Wall -g -o $@ $<
$(CC) -c -Wall -g -o $@ $<
src/tools/main.o:: src/tools/server-unix.c src/tools/server-win.c
%.o: %.c
$(CC) -c -Wall -g -o $@ $<
install_no_local::
cp -f lib/why3server$(EXE) $(LIBDIR)/why3/why3server$(EXE)
cp -f lib/why3cpulimit$(EXE) $(LIBDIR)/why3/why3cpulimit$(EXE)
cp -f lib/why3-call-pvs $(LIBDIR)/why3/why3-call-pvs
clean::
rm -f $(SERVER_O)
install_spark2014:
mkdir -p $(BINDIR)
mkdir -p $(DATADIR)/why3
mkdir -p $(DATADIR)/why3/theories
mkdir -p $(DATADIR)/why3/drivers
mkdir -p $(DATADIR)/why3/modules
mkdir -p $(DATADIR)/why3/libs
cp -f theories/*.why $(DATADIR)/why3/theories
cp -f modules/*.mlw $(DATADIR)/why3/modules
cp -f drivers/*.drv drivers/*.gen drivers/*.aux $(DATADIR)/why3/drivers
cp -f share/why3session.dtd $(DATADIR)/why3
cp -f lib/why3server$(EXE) $(BINDIR)/why3server$(EXE)
cp -f bin/gnatwhy3.@OCAMLBEST@ $(BINDIR)/gnatwhy3$(EXE)
cp -f bin/why3realize.@OCAMLBEST@ $(BINDIR)/why3realize$(EXE)
cp -f bin/why3config.@OCAMLBEST@ $(BINDIR)/why3config$(EXE)
cp -f share/provers-detection-data.conf $(DATADIR)/why3/
cp -rf lib/coq $(DATADIR)/why3/libs
rm -f $(SERVER_O) $(CPULIM_O) $(TOOLS)
##########
# gallery
......@@ -873,7 +865,7 @@ lib/coq-tactic/why3tac.cmxs: lib/why3/why3.cmxa $(COQPCMX)
$(if $(QUIET),@echo 'Linking $@' &&) \
$(OCAMLOPT) $(OFLAGS) -o $@ -shared $^
lib/coq-tactic/why3tac.cma: src/driver/vc_client.o lib/why3/why3.cma $(COQPCMO)
lib/coq-tactic/why3tac.cma: lib/why3/why3.cma $(COQPCMO)
$(if $(QUIET),@echo 'Linking $@' &&) \
$(OCAMLC) -a $(BFLAGS) -o $@ $^
......@@ -1442,24 +1434,6 @@ clean::
endif
#######
# tools
#######
TOOLS = lib/why3-cpulimit$(EXE)
byte opt: $(TOOLS)
lib/why3-cpulimit$(EXE): src/tools/@CPULIMIT@.c
$(CC) -Wall -o $@ $^
clean::
rm -f lib/why3-cpulimit$(EXE)
install_no_local::
cp -f lib/why3-cpulimit$(EXE) $(LIBDIR)/why3/why3-cpulimit$(EXE)
cp -f lib/why3-call-pvs $(LIBDIR)/why3/why3-call-pvs
#########
# why3doc
#########
......
......@@ -140,18 +140,15 @@ AC_MSG_CHECKING(executable suffix)
if uname -s | grep -q CYGWIN ; then
EXE=.exe
STRIP='echo "no strip "'
CPULIMIT=cpulimit-win
AC_MSG_RESULT(.exe <Cygwin>)
else
if uname -s | grep -q MINGW ; then
EXE=.exe
STRIP=strip
CPULIMIT=cpulimit-win
AC_MSG_RESULT(.exe <MinGW>)
else
EXE=
STRIP=strip
CPULIMIT=cpulimit
AC_MSG_RESULT(<none>)
fi
fi
......@@ -719,7 +716,6 @@ AC_SUBST(enable_verbose_make)
AC_SUBST(EXE)
AC_SUBST(STRIP)
AC_SUBST(CPULIMIT)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
......
......@@ -267,7 +267,7 @@ let actualcommand command ~use_why3cpulimit limit interactive file =
in
let args =
if use_why3cpulimit && not interactive then
let cpulimit_bin = Filename.concat Config.libdir "why3-cpulimit" in
let cpulimit_bin = Filename.concat Config.libdir "why3cpulimit" in
let cpulimit_time =
(* for steps limit use 2 * t + 1 time *)
if limit.limit_steps <> None then string_of_int (2 * timelimit + 1)
......
......@@ -76,9 +76,9 @@ let run_server () =
let force_connect () =
match !socket with
| None when !standalone ->
run_server ();
(* sleep is needed before connecting, or the server will not be ready
yet *)
let _pid = run_server () in
(* sleep is needed before connecting,
or the server will not be ready yet *)
ignore (Unix.select [] [] [] 0.1);
connect()
| _ -> ()
......
......@@ -48,9 +48,3 @@
// events are incoming clients, read/write operations on sockets, and
// terminating child processes. Lists of child processes and connected clients
// are maintained.
#ifdef _WIN32
# include "server-win.c"
#else
# include "server-unix.c"
#endif
......@@ -9,6 +9,8 @@
/* */
/********************************************************************/
#ifndef _WIN32
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
......@@ -145,3 +147,5 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
#endif /* _WIN32 */
......@@ -17,6 +17,8 @@
/* $Id: cpulimit-win.c,v 1.3 2009-12-09 08:28:00 nrousset Exp $ */
#ifdef _WIN32
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
......@@ -203,5 +205,7 @@ int main(int argc, char *argv[]) {
return ex;
}
#endif /* _WIN32 */
// How to compile under Cygwin (needs make, gcc and win32api):
// gcc -Wall -o cpulimit cpulimit.c
......@@ -5,6 +5,8 @@
// Contrary to the situation on windows, e.g. a read event means that the next
// call to read() will not block.
#ifndef _WIN32
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
......@@ -544,3 +546,5 @@ int main(int argc, char **argv) {
}
}
}
#endif /* _WIN32 */
......@@ -5,6 +5,8 @@
// windows: you need to start them first, and get notified when they are
// terminated.
#ifdef _WIN32
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -648,3 +650,5 @@ int main(int argc, char **argv) {
}
}
}
#endif /* _WIN32 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment