##
##  Makefile -- Build procedure for WebKit Apache module
##  Can also be autogenerated via ``apxs -n webkit -g''.
##

#   the used tools

#APXS=apxs
APXS=/usr/sbin/apxs
#APXS=/usr/local/apache2/bin/apxs
#APXS=apxs2
#APXS=/usr/sbin/apxs2

APACHECTL=apachectl
#APACHECTL=/usr/sbin/apachectl
#APACHECTL=apache2ctl
#APACHECTL=/usr/sbin/apache2ctl

# CC=`$(APXS) -q CC`
# CFLAGS=`$(APXS) -q CFLAGS`
# INC=-I`$(APXS) -q INCLUDEDIR`
# LD_SHLIB=`$(APXS) -q LDFLAGS_SHLIB`

#   You can pass authorization information (passwords)
#   from Apache to WebKit, even if Apache has not been
#   compiled with this feature, by defining the following:
#DEF=-DSECURITY_HOLE_PASS_AUTHORIZATION

SRC = mod_webkit.c marshal.c
OBJ = ${SRC:.c=.o}
SOBJ = ${SRC:.c=.lo}

#   the default target
all: mod_webkit.la

#   compile the DSO file
mod_webkit.la: $(OBJ)
	$(APXS) -c -o mod_webkit.la $(SOBJ)

mod_webkit.o: mod_webkit.c
	$(APXS) $(DEF) -c mod_webkit.c

marshal.o: marshal.c
	$(APXS) -c marshal.c

#   install the DSO file into the Apache installation
#   and activate it in the Apache configuration
install: all
	$(APXS) -i -n webkit mod_webkit.la

#   install and activate it in the Apache configuration
activate: all
	$(APXS) -i -a -n webkit mod_webkit.la

#   cleanup
clean:
	-rm -rf *.o *.lo *.slo *.la .libs

#   reload the module by installing and restarting Apache
reload: install restart

#   the general Apache start/restart/stop procedures
start:
	$(APACHECTL) start
restart:
	$(APACHECTL) restart
stop:
	$(APACHECTL) stop
