#!/usr/bin/make

# This makefile is for demoing an apache httpd and mozilla with
# HTTP Extensions. It is intended to be called from ../..
# ../..# make -f 2002/httpExt/Makefile demo

# You will need to check out patchPanel to run this demo.
# cvs -d :pserver:anonymous@dev.w3.org:/sources/public co patchPanel

OPTIONAL_EXT	= http://localhost:9002/doc1.xhtml
REQUIRED_EXT	= http://localhost:9002/dir1/doc2.xhtml
HTTP_EXT_INFO	= http://localhost:9002/PEP
EXTENSION_LIST	= http://localhost:9002/PEP?list
XTERM_OPTIONS	= -sl 8192

# Try these with lynx, too. The REQUIRED_EXT URL should result in a
# Not Extended (510) error.

all: demo

httpd-2.0/.libs/httpd: 
	(cd httpd-2.0/ && cvs update -d && cd .. && patch -p 0 < diskCache/typedefFuncs-20020816.patch && patch -p 0 < diskCache/proxy-apache_2-diff.patch && ./buildconf && cd httpd-2.0/ && CFLAGS= ./configure --prefix=/usr/local/apache-2-justProxy --enable-maintainer-mode --with-mpm=prefork --enable-expires --enable-headers --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache && make)

docServer: httpd-2.0/.libs/httpd
	./httpd-2.0/httpd -DONE_PROCESS -d diskCache/DocServerRoot/ &

proxyServer: httpd-2.0/.libs/httpd
	./httpd-2.0/httpd -DONE_PROCESS -d diskCache/ProxyServerRoot/ &

xterms: 
	xterm -T proxy\ server $(XTERM_OPTIONS) -e ./patchPanel/patchPanel "proxy 9004 localhost 9003" "mask DATA" &
	xterm -T manual\ server $(XTERM_OPTIONS) -e ./patchPanel/patchPanel "accept 9005" "mask DATA" &
	xterm -T manual\ client $(XTERM_OPTIONS) -e ./patchPanel/patchPanel "connect localhost 9004" "mask DATA" &

demo: docServer proxyServer patchPanel/patchPanel xterms

patchPanel/patchPanel.cpp:
	cvs -d :pserver:anonymous@dev.w3.org:/sources/public co patchPanel

patchPanel/patchPanel: patchPanel/patchPanel.cpp
	(cd patchPanel && make)

killDocServer: 
	kill `cat diskCache/DocServerRoot/logs/httpd.pid`

killProxyServer: 
	kill `cat diskCache/ProxyServerRoot/logs/httpd.pid`

kill: killDocServer killProxyServer

