#   the used tools
APXS=apxs
APACHECTL=apachectl

#   additional user defines, includes and libraries
INC=-I`pg_config --includedir`
LIB=-L`pg_config --libdir`  -lpq

#   the default target
all: mod_pgsample.so

#   compile the DSO file
mod_pgsample.so: mod_pgsample.c
	$(APXS) -c $(DEF) $(INC) $(LIB) mod_pgsample.c

#   install the DSO file into the Apache installation
#   and activate it in the Apache configuration
install: all
	$(APXS) -i -a -n 'pgsample' mod_pgsample.so

#   cleanup
clean:
	-rm -f mod_pgsample.o mod_pgsample.so

#   simple test
test: reload
	lynx -mime_header http://localhost/pgsample

#   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

