# set APACHE_DIR_BIN to the directory where apxs is located
APACHE_DIR_BIN = /apache/bin
AOLSERVER_DIR = /aolserver
INSTALL_DIR = /iws/bin/linux

#DEBUG = -D_DEBUG -g
CC = gcc -w -c
CL = gcc -w

.c.o:
	$(CC) $(DEBUG) $*.c

.o:
	$(CL) $? -o $@

all: apacheGateway.so aolServerGateway.so cgiGateway

install:
	cp apacheGateway.so $(INSTALL_DIR)
	cp aolServerGateway.so $(INSTALL_DIR)
	cp cgiGateway $(INSTALL_DIR)
clean:
	rm -f *.so
	rm -f *.o
	rm -f cgiGateway

apacheGateway.so: apacheGateway.c gateway.o dString.o cluster.o
	$(APACHE_DIR_BIN)/apxs -c $?

aolServerGateway.so: aolServerGateway.c gateway.o dString.o cluster.o
	$(CL) -rdynamic -shared -I$(AOLSERVER_DIR)/include -D_REENTRANT $? -o $@

cgiGateway: cgiGateway.o gateway.o headers.o dString.o

cgiGateway.o: cgiGateway.c headers.h gateway.h

gateway.o: gateway.c gateway.h
headers.o: headers.c headers.h
dString.o: dString.c dString.h
cluster.o: cluster.c cluster.h
