#   the target to build
TARGET=mod_gzip

#   the used tools
APXS=/usr/local/apache2/bin/apxs
APACHECTL=/usr/local/apache2/bin/apachectl

#   additional defines, includes and libraries
LIBDIR=/usr/lib
#INC=-I/usr/include/zlib
LIB=-lz -L$(LIBDIR)

#   the default target
OPT=-Wc,-Wall
OPT+=-Wl,--rpath -Wl,$(LIBDIR)

#   the default target
all: $(TARGET).la

#   compile the shared object file
%.la: %.c
	$(APXS) -c $(OPT) $(DEF) $(INC) $(LIB) $<

#   create a preprocessed source file
%.pre: %.c
	$(CC) -E $(OPT) $(DEF) $(INC) $(LIB) $<

#   install the shared object file into Apache 
install: all
	$(APXS) -i $(TARGET).la

#   install the shared object file into Apache and make entry in httpd.conf
installfirst: all
	$(APXS) -i -a -n '$(TARGET)' $(TARGET).la

#   cleanup
clean:
	-rm -f $(TARGET).o $(TARGET).l* $(TARGET).s*
	-rm -f -r ./.libs

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

#   install and activate shared object by reloading Apache to
#   force a reload of the shared object file
reload: install restart

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

