# Don't edit Makefile! Use ../conf-* for configuration.

SHELL=/bin/sh

default: \
it-ldap

auto-ccld.sh: \
../conf-cc ../conf-ld ../conf-qlibs ../conf-ldap warn-auto.sh
	( cat warn-auto.sh; \
	echo CC=\'`head -1 ../conf-cc` \
	-I`head -1 ../conf-qlibs`/include \
	`grep ^-I ../conf-ldap`\'; \
	echo LD=\'`head -1 ../conf-ld`\' \
	) > auto-ccld.sh

auto_qmail.c: \
auto-str ../conf-home
	./auto-str auto_qmail `head -1 ../conf-home` > auto_qmail.c
 
auto_qmail.o: \
compile auto_qmail.c
	./compile auto_qmail.c

auto-str: \
load auto-str.o qlibs.lib
	./load auto-str `cat qlibs.lib`
 
auto-str.o: \
compile auto-str.c
	./compile auto-str.c

compile: \
make-compile warn-auto.sh systype
	( cat warn-auto.sh; ./make-compile "`cat systype`" ) > \
	compile
	chmod 755 compile

control.o: \
compile control.c 
	./compile control.c

digest_md5.o:
	./compile digest_md5.c

md5c.o : \
compile md5c.c 
	./compile md5c.c

hmac_md5.o : \
compile hmac_md5.c 
	./compile hmac_md5.c

clean: \
TARGETS
	rm -f `cat TARGETS`

it-ldap: \
include/auto_qmail.h include/control.h include/qmail.h \
include/global.h include/md5.h \
qmail-ldapam digest_md5.o 

ldap.lib: \
tryldap.c compile load ../conf-ldap
	( ( ./compile tryldap.c && \
	./load tryldap `grep ^-L ../conf-ldap` -lldap ) >/dev/null 2>&1 \
	&& echo "`grep ^-L ../conf-ldap` -lldap" || exit 0 ) > ldap.lib
#       rm -f tryldap.o tryldap

load: \
make-load warn-auto.sh systype
	( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
	chmod 755 load

make-compile: \
make-compile.sh auto-ccld.sh
	cat auto-ccld.sh make-compile.sh > make-compile
	chmod 755 make-compile

make-load: \
make-load.sh auto-ccld.sh
	cat auto-ccld.sh make-load.sh > make-load
	chmod 755 make-load

qlibs.lib: \
tryqlibs.c compile load
	( (./compile -I`head -1 ../conf-qlibs`/include tryqlibs.c && \
	./load tryqlibs -L`head -1 ../conf-qlibs` -lqlibs ) \
	&& echo "-L`head -1 ../conf-qlibs` -lqlibs" || exit 0 ) > qlibs.lib
	rm -f tryqlibs.o tryqlibs

qmail-ldapam: \
load qmail-ldapam.o auto_qmail.o control.o \
qlibs.lib ldap.lib 
	./load qmail-ldapam auto_qmail.o control.o \
	`cat qlibs.lib` `cat ldap.lib`

qmail-ldapam.o: \
compile qmail-ldapam.c 
	./compile qmail-ldapam.c

sha1.o: \
compile sha1.c 
	./compile sha1.c

sha256.o : \
compile sha256.c 
	./compile sha256.c

systype: \
find-systype trycpp.c
	./find-systype > systype
# done.
