# $Id: Makefile.in,v 1.4 2001/10/02 19:03:52 jesus Exp $
# Makefile.in for mod_backhand

# Modified for Debian by James Bromberger <james@rcpt.to>
#
# Define the following install areas
#    bindir -> where the mod_backhand.so DSO goes
#    webdir -> where the images used in dynamically generate pages live
#    cgidir -> where the cgi scripts go

SHELL = /bin/sh
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

.SUFFIXES:
.SUFFIXES: .c .o

OPT=-g -O

AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@

DEBIAN = @DEBIAN@
CC = @CC@
CFLAGS = -I. @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
INSTALL = @INSTALL@
BUILD_IT = @BUILD_IT@
INCLUDE = -I. @APACHE_INCLUDE@
APXS = @APXS@
BINNAME = @BINNAME@
APXS_LDFLAGS = @APXS_LDFLAGS@     
APXS_LIBS = @APXS_LIBS@     
prefix = @prefix@
exec_prefix = @exec_prefix@

ifdef DEBIAN
	bindir = $(exec_prefix)/lib/apache/1.3
else
	bindir = $(exec_prefix)/bin
	libdir = $(prefix)/lib
	infodir = $(prefix)/info
endif

# Debian adds some defines for installation places and things to put there
ifdef DEBIAN
	cgidir = $(prefix)/lib/cgi-bin
	webdir = $(prefix)/share/libapache-mod-backhand
	CGICONTENT = backhand-test
	WEBCONTENT = backhand.jpg cndsbar_mini.jpg mod_backhand_mini.jpg
endif

# ??? replace these with your own list of files
SOURCES=mod_backhand.c back_util.c apue.c arriba.c builtins.c
DOCS=
MISC=configure
OBJS=mod_backhand.o back_util.o apue.o arriba.o builtins.o
LIB_OBJS=

# ??? replace with your targets
#all: mod_backhand.so
all: $(BINNAME) byHostname

# ??? here I make the bindir, libdir and infodir directories; you
# might not need all of these.  also, I assumed the names PROG and
# libMYPROG.a for the program and library.
install: all

	# Debian doesn't want the libdir or info dir
ifdef DEBIAN
	# But Debian does want a place for the web images and CGI scripts
	# Don't need to create install directories... 
	# dh_installdirs does this for us.
	$(INSTALL) -d $(cgidir)
	$(INSTALL) -m 0755 $(CGICONTENT) $(cgidir)/
	$(INSTALL) -d $(webdir)
	$(INSTALL) -m 0644 $(WEBCONTENT) $(webdir)/
else
	$(top_srcdir)/mkinstalldirs $(bindir)
	$(top_srcdir)/mkinstalldirs $(libdir)
	$(top_srcdir)/mkinstalldirs $(infodir)
endif
	$(INSTALL) $(BINNAME) $(bindir)/$(BINNAME)
	$(INSTALL) byHostname.so $(bindir)/byHostname.so
	#$(APXS) -i -A -n backhand $(BINNAME)

#$(INSTALL) mod_backhand.so $(bindir)/mod_backhand.so

uninstall:
	/bin/rm -f $(bindir)/$(BINNAME)

$(BINNAME): $(SOURCES)
	$(BUILD_IT)

clean:
	/bin/rm -f core *.o $(OBJS) $(LIB_OBJS) $(BINNAME) byHostname.so

byHostname:
	$(APXS) -o byHostname.so -c byHostname.c

distclean: clean
	/bin/rm -f Makefile config.h config.status config.cache config.log

mostlyclean: clean

maintainer-clean: clean

# automatic re-running of configure if the configure.in file has changed
${srcdir}/configure: configure.in
	cd ${srcdir} && autoconf

# autoheader might not change config.h.in, so touch a stamp file
${srcdir}/config.h.in: stamp-h.in
${srcdir}/stamp-h.in: configure.in
	cd ${srcdir} && autoheader
	echo timestamp > ${srcdir}/stamp-h.in

config.h: stamp-h
stamp-h: config.h.in config.status
	./config.status
Makefile: Makefile.in config.status
	./config.status
config.status: configure
	./config.status --recheck
