# Don't edit Makefile!  Use conf-* for configuration.
#
# Generated by spac see http://untroubled.org/spac/

SHELL=/bin/sh

DEFAULT: all

all: libraries programs docs

clean: TARGETS
	rm -f `cat TARGETS`

clean-spac: clean AUTOFILES
	rm -f `cat AUTOFILES`

compile: conf-cc
	( echo '#!/bin/sh'; \
	  echo 'source=$$1; shift'; \
	  echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \
	  echo exec `head -n 1 conf-cc` -I.  '-o $${base}.o -c $$source $${1+"$$@"}'; \
	) >compile
	chmod 755 compile

docs: qmail-autoresponder-mysql.1.html qmail-autoresponder.1.html

headers.o: compile headers.c qmail-autoresponder.h
	./compile headers.c

install: INSTHIER conf-bin conf-man
	bg-installer -v <INSTHIER
	bg-installer -c <INSTHIER

libraries: 

load: conf-ld
	( echo '#!/bin/sh';\
	  echo 'main="$$1"; shift';\
	  echo exec `head -n 1 conf-ld` -L. '-o "$$main" "$$main.o" $${1+"$$@"}'; \
	) >load
	chmod 755 load

main.o: compile main.c qmail-autoresponder.h
	./compile main.c

mysql: qmail-autoresponder-mysql schema.mysql

options.o: compile options.c qmail-autoresponder.h
	./compile options.c

programs: qmail-autoresponder

qmail-autoresponder: qmail-autoresponder.o load headers.o main.o options.o qmail.o response.o
	./load qmail-autoresponder headers.o main.o options.o qmail.o response.o -lbg 

qmail-autoresponder-mysql: qmail-autoresponder-mysql.o load headers.o main.o options.o qmail.o response.o
	./load qmail-autoresponder-mysql headers.o main.o options.o qmail.o response.o -lbg -L/usr/lib/mysql -L/usr/local/lib/mysql -lmysqlclient 

qmail-autoresponder-mysql.1.html: qmail-autoresponder-mysql.1
	man --html='cat %s' ./qmail-autoresponder-mysql.1 > qmail-autoresponder-mysql.1.html

qmail-autoresponder-mysql.o: compile qmail-autoresponder-mysql.c qmail-autoresponder.h
	./compile qmail-autoresponder-mysql.c

qmail-autoresponder.1.html: qmail-autoresponder.1
	man --html='cat %s' ./qmail-autoresponder.1 > qmail-autoresponder.1.html

qmail-autoresponder.o: compile qmail-autoresponder.c qmail-autoresponder.h
	./compile qmail-autoresponder.c

qmail.o: compile qmail.c qmail-autoresponder.h
	./compile qmail.c

response.o: compile response.c qmail-autoresponder.h
	./compile response.c

schema.mysql: schema.mysql.in
	sed -e 's/@PREFIX@//g' <schema.mysql.in >schema.mysql

