##
##  Makefile -- Build procedure for Midgard Apache module
##  Autogenerated via ``apxs -n midgard -g''.
##
PACKAGE = mod_midgard
VERSION = 1.4-beta5a

# the used tools
APXS=@APXS@
INSTALL=@INSTALL@

# additional defines, includes and libraries
DEF=@DEFS@
INC=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
LIB=@LIBS@

.c.o:
	@rm -f $@
	$(CC) $(CFLAGS) $(DEF) $(INC) -c $< -o $@

# the default target
all: mod_midgard.so

# compile the shared object file
mod_midgard.so: mod_midgard.c
	$(APXS) -c $(DEF) $(INC) $(LDFLAGS) $(LIB) mod_midgard.c

# install the shared object file into Apache 
install: all
	$(APXS) -i -a -n 'midgard' mod_midgard.so
	$(INSTALL) -m 644 midgard-root.php3 `$(APXS) -q LIBEXECDIR`
	$(INSTALL) -m 644 midgard-root.php `$(APXS) -q LIBEXECDIR`

# set up the httpd.conf file for Midgard use
conf:
	## make conf has been deprecated, configuration of
	## Apache is now handled by midgard-data

# distribution
# based on the rules used by automake
DISTFILES = README AUTHORS COPYING ChangeLog INSTALL Makefile.in NEWS \
	configure configure.in install-sh midgard-root.php3 midgard.conf \
	mod_midgard.c README.ru INSTALL.ru
TAR = gtar
GZIP_ENV = --best
distdir = $(PACKAGE)-$(VERSION)

dist: distdir
	-chmod -R a+r $(distdir)
	GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
	-rm -rf $(distdir)

distdir: $(DISTFILES)
	-rm -rf $(distdir)
	mkdir $(distdir)
	-chmod 777 $(distdir)
	@for file in $(DISTFILES); do \
	  if test -d $$file; then \
	    cp -pr $$file $(distdir)/$$file; \
	  else \
	    test -f $(distdir)/$$file \
	    || ln $$file $(distdir)/$$file 2> /dev/null \
	    || cp -p $$file $(distdir)/$$file || :; \
	  fi; \
	done

# cleanup
maintainerclean: distclean
	-rm -f configure Makefile

distclean: clean
	-rm -f config.*

clean: mostlyclean
	-rm -f mod_midgard.so

mostlyclean:
	-rm -f mod_midgard.o
