##
##  Makefile -- Build procedure for sample text2html Apache module
##  Autogenerated via ``apxs -n text2html -g''.
##

#   the used tools
APXS=apxs
APACHECTL=apachectl
VERSION = 1.0
DISTNAME = mod_text2html
DISTVNAME = $(DISTNAME)-$(VERSION)

SHELL = /bin/sh
PERL = perl
NOOP = $(SHELL) -c true
RM_RF = rm -rf
SUFFIX = .gz
COMPRESS = gzip --best
TAR  = tar
TARFLAGS = cvf
PREOP = @$(NOOP)
POSTOP = @$(NOOP)
TO_UNIX = @$(NOOP)


#   additional user defines, includes and libraries
#DEF=-Dmy_define=my_value
#INC=-Imy/include/dir
#LIB=-Lmy/lib/dir -lmylib

#   the default target
all: mod_text2html.so

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

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

#   cleanup
clean:
	-rm -f mod_text2html.o mod_text2html.so *.gz

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

#   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

dist: clean version $(DISTVNAME).tar$(SUFFIX)

version:
	echo $(VERSION) > VERSION
	echo "#define VERSION \"$(VERSION)\"" > version.h


$(DISTVNAME).tar$(SUFFIX) : distdir
	$(PREOP)
	$(TO_UNIX)
	$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
	$(RM_RF) $(DISTVNAME)
	$(COMPRESS) $(DISTVNAME).tar
	$(POSTOP)

distdir :
# $(RM_RF) $(DISTVNAME)
	$(PERL) -MExtUtils::Manifest=manicopy,maniread \
	-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"

push :
	if [ -F *.gz ] ; then \
		rm *.gz; \
	fi
	make dist
	scp *.gz root@www.tangent.org:/usr/local/slash/site/software.tangent.org/htdocs/download
	scp *.gz root@ftp.tangent.org:/export/ftp/pub/apache
