# Select the directory name and webserver alias for your WebCit binaries.
WEBCIT_PATH=/usr/local/webcit
WEBCIT_URL=/webcit

# Select the directory name and webserver alias for a spool directory to hold
# downloaded stuff such as server graphics.
# Please remember to create this directory.
DYNAMIC_PATH=/var/webcit-dynamic
DYNAMIC_URL=/webcit-dynamic

# Select the directory name and webserver alias for the directory which holds
# static data such as the chat client classes.
STATIC_PATH=/usr/local/webcit/static
STATIC_URL=/webcit-static

# Select the default host and port to connect to.
DEFAULT_HOST=localhost
DEFAULT_PORT=504

# Timeout value for browser connections.  Usually there is no need to edit.
BROWSER_TIMEOUT=1500

# Select the host and port of a working HTTP proxy server.  It is preferable
# that you turn on proxy service on the local host's webserver, and point to
# localhost/80 for best performance.
HTTP_PROXY_HOST=localhost
HTTP_PROXY_PORT=80

# Uncomment this line if you want WebCit to cut log records.  Comment it out
# if you don't.
LOG=-DUSE_SYSLOG

### Do not edit below this line ###

all: webcit session

webcit: webcit.o tcp_sockets.o serv_func.o support.o \
	auth.o messages.o roomops.o mainloop.o misc.o \
	images.o who.o netconf.o
	cc webcit.o tcp_sockets.o serv_func.o misc.o \
	support.o auth.o messages.o roomops.o mainloop.o \
	images.o who.o netconf.o -o webcit

webcit.o: webcit.c ipcdef.h
	cc -c \
	-DBROWSER_TIMEOUT=$(BROWSER_TIMEOUT) \
	-DDYNAMIC_PATH=\"$(DYNAMIC_PATH)\" \
	-DDYNAMIC_URL=\"$(DYNAMIC_URL)\" \
	$(LOG) \
	webcit.c

auth.o: auth.c ipcdef.h
	cc -c \
	auth.c

who.o: who.c ipcdef.h
	cc -c who.c

netconf.o: netconf.c ipcdef.h
	cc -c netconf.c

images.o: images.c ipcdef.h
	cc -c \
	-DDYNAMIC_PATH=\"$(DYNAMIC_PATH)\" \
	-DDYNAMIC_URL=\"$(DYNAMIC_URL)\" \
	-DHTTP_PROXY_HOST=\"$(HTTP_PROXY_HOST)\" \
	-DHTTP_PROXY_PORT=\"$(HTTP_PROXY_PORT)\" \
	images.c

roomops.o: roomops.c ipcdef.h
	cc -c roomops.c \
	-DSTATIC_URL=\"$(STATIC_URL)\"

messages.o: messages.c ipcdef.h
	cc -c messages.c

mainloop.o: mainloop.c ipcdef.h
	cc -c mainloop.c \
	-DSTATIC_URL=\"$(STATIC_URL)\"

misc.o: misc.c ipcdef.h
	cc -c misc.c

support.o: support.c
	cc -c support.c

serv_func.o: serv_func.c ipcdef.h
	cc -c serv_func.c

tcp_sockets.o: tcp_sockets.c ipcdef.h
	cc -c tcp_sockets.c

ipcdef.h: sysdep.h
	touch ipcdef.h

sysdep.h: configure.sh
	sh ./configure.sh cc

session: session.c
	cc \
	-DDEFAULT_HOST=\"$(DEFAULT_HOST)\" -DDEFAULT_PORT=\"$(DEFAULT_PORT)\" \
	$(LOG) \
	session.c -o session
	chmod 1755 session

clean:
	find . -name \*.o -exec rm -f {} \;
	rm -f sysdep.h webcit session
