# 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`

client_domain.lo client_domain.o: ltcompile client_domain.c v1client.h facts.h errors.h
	./ltcompile client_domain.c

client_setenv.lo client_setenv.o: ltcompile client_setenv.c v1client.h facts.h errors.h
	./ltcompile client_setenv.c

client_setugid.lo client_setugid.o: ltcompile client_setugid.c v1client.h facts.h errors.h
	./ltcompile client_setugid.c

client_xfer_command.lo client_xfer_command.o: ltcompile client_xfer_command.c v1client.h facts.h errors.h
	./ltcompile client_xfer_command.c

client_xfer_compat.lo client_xfer_compat.o: ltcompile client_xfer_compat.c v1client.h facts.h errors.h
	./ltcompile client_xfer_compat.c

client_xfer_local.lo client_xfer_local.o: ltcompile client_xfer_local.c v1client.h facts.h errors.h protocol.h
	./ltcompile client_xfer_local.c

client_xfer_udp.lo client_xfer_udp.o: ltcompile client_xfer_udp.c v1client.h facts.h errors.h protocol.h
	./ltcompile client_xfer_udp.c

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

crypt.lib: compile load
	@echo -n 'Checking for -lcrypt: '
	@echo 'main() { ; }' >trylib-lcrypt.c
	@{ ./compile trylib-lcrypt.c && ./load trylib-lcrypt -lcrypt; } >/dev/null 2>&1 \
	  && { echo -lcrypt >crypt.lib; echo yes; } \
	  || { echo -n >crypt.lib; echo no; }
	@rm -f trylib-lcrypt.c trylib-lcrypt.o trylib-lcrypt

cvm-benchclient: cvm-benchclient.o ltload libcvm-v2client.la socket.lib
	./ltload cvm-benchclient libcvm-v2client.la -lbg `cat socket.lib`

cvm-benchclient.o: compile cvm-benchclient.c v2client.h facts.h errors.h
	./compile cvm-benchclient.c

cvm-chain: cvm-chain.o ltload libcvm-module.la libcvm-v2client.la socket.lib s.lib
	./ltload cvm-chain libcvm-module.la libcvm-v2client.la -lbg `cat socket.lib` `cat s.lib`

cvm-chain.o: compile cvm-chain.c module.h credentials.h errors.h facts.h v2client.h
	./compile cvm-chain.c

cvm-checkpassword: cvm-checkpassword.o ltload libcvm-v2client.la socket.lib
	./ltload cvm-checkpassword libcvm-v2client.la -lbg `cat socket.lib`

cvm-checkpassword.o: compile cvm-checkpassword.c v2client.h facts.h errors.h
	./compile cvm-checkpassword.c

cvm-mysql: cvm-mysql.o ltload libcvm-module.la libcvm-sql.la crypt.lib
	./ltload cvm-mysql libcvm-module.la libcvm-sql.la -lbg -lpwcmp -L/usr/lib/mysql -lmysqlclient `cat crypt.lib`

cvm-mysql-local: cvm-mysql-local.o ltload cvm-mysql.o libcvm-local.la libcvm-sql.la crypt.lib
	./ltload cvm-mysql-local cvm-mysql.o libcvm-local.la libcvm-sql.la -lbg -lpwcmp -L/usr/lib/mysql -lmysqlclient `cat crypt.lib`

cvm-mysql-local.o: compile cvm-mysql-local.c
	./compile cvm-mysql-local.c

cvm-mysql-udp: cvm-mysql-udp.o ltload cvm-mysql.o libcvm-udp.la libcvm-sql.la crypt.lib
	./ltload cvm-mysql-udp cvm-mysql.o libcvm-udp.la libcvm-sql.la -lbg -lpwcmp -L/usr/lib/mysql -lmysqlclient `cat crypt.lib`

cvm-mysql-udp.o: compile cvm-mysql-udp.c
	./compile cvm-mysql-udp.c

cvm-mysql.o: compile cvm-mysql.c module.h credentials.h errors.h facts.h sql.h
	./compile cvm-mysql.c

cvm-pgsql: cvm-pgsql.o ltload libcvm-module.la libcvm-sql.la crypt.lib
	./ltload cvm-pgsql libcvm-module.la libcvm-sql.la -lbg -lpwcmp -lpq `cat crypt.lib`

cvm-pgsql-local: cvm-pgsql-local.o ltload cvm-pgsql.o libcvm-local.la libcvm-sql.la crypt.lib
	./ltload cvm-pgsql-local cvm-pgsql.o libcvm-local.la libcvm-sql.la -lbg -lpwcmp -lpq `cat crypt.lib`

cvm-pgsql-local.o: compile cvm-pgsql-local.c
	./compile cvm-pgsql-local.c

cvm-pgsql-udp: cvm-pgsql-udp.o ltload cvm-pgsql.o libcvm-udp.la libcvm-sql.la crypt.lib
	./ltload cvm-pgsql-udp cvm-pgsql.o libcvm-udp.la libcvm-sql.la -lbg -lpwcmp -lpq `cat crypt.lib`

cvm-pgsql-udp.o: compile cvm-pgsql-udp.c
	./compile cvm-pgsql-udp.c

cvm-pgsql.o: compile cvm-pgsql.c module.h credentials.h errors.h facts.h sql.h
	./compile cvm-pgsql.c

cvm-pwfile: cvm-pwfile.o ltload libcvm-module.la crypt.lib socket.lib
	./ltload cvm-pwfile libcvm-module.la -lbg -lpwcmp `cat crypt.lib` `cat socket.lib`

cvm-pwfile.o: compile cvm-pwfile.c module.h credentials.h errors.h facts.h
	./compile cvm-pwfile.c

cvm-qmail: cvm-qmail.o ltload getpwnam.o libcvm-module.la libcvm-qmail.la crypt.lib
	./ltload cvm-qmail getpwnam.o libcvm-module.la libcvm-qmail.la -lbg `cat crypt.lib`

cvm-qmail.o: compile cvm-qmail.c module.h credentials.h errors.h facts.h qmail.h
	./compile cvm-qmail.c

cvm-sqlite: cvm-sqlite.o ltload libcvm-module.la libcvm-sql.la crypt.lib
	./ltload cvm-sqlite libcvm-module.la libcvm-sql.la -lbg -lpwcmp -L/usr/lib/sqlite -lsqlite3 `cat crypt.lib`

cvm-sqlite.o: compile cvm-sqlite.c module.h credentials.h errors.h facts.h sql.h
	./compile cvm-sqlite.c

cvm-testclient: cvm-testclient.o ltload libcvm-v2client.la socket.lib
	./ltload cvm-testclient libcvm-v2client.la -lbg `cat socket.lib`

cvm-testclient.o: compile cvm-testclient.c v2client.h facts.h errors.h
	./compile cvm-testclient.c

cvm-unix: cvm-unix.o ltload getpwnam.o libcvm-module.la crypt.lib shadow.lib s.lib socket.lib
	./ltload cvm-unix getpwnam.o libcvm-module.la -lbg `cat crypt.lib` `cat shadow.lib` `cat s.lib` `cat socket.lib`

cvm-unix.o: compile cvm-unix.c module.h credentials.h errors.h facts.h
	./compile cvm-unix.c

cvm-v1benchclient: cvm-v1benchclient.o ltload libcvm-v1client.la socket.lib
	./ltload cvm-v1benchclient libcvm-v1client.la -lbg `cat socket.lib`

cvm-v1benchclient.o: compile cvm-v1benchclient.c v1client.h facts.h errors.h
	./compile cvm-v1benchclient.c

cvm-v1checkpassword: cvm-v1checkpassword.o ltload libcvm-v1client.la socket.lib
	./ltload cvm-v1checkpassword libcvm-v1client.la -lbg `cat socket.lib`

cvm-v1checkpassword.o: compile cvm-v1checkpassword.c v1client.h facts.h errors.h
	./compile cvm-v1checkpassword.c

cvm-v1testclient: cvm-v1testclient.o ltload libcvm-v1client.la socket.lib
	./ltload cvm-v1testclient libcvm-v1client.la -lbg `cat socket.lib`

cvm-v1testclient.o: compile cvm-v1testclient.c v1client.h facts.h errors.h
	./compile cvm-v1testclient.c

cvm-vchkpw: cvm-vchkpw.o ltload libcvm-module.la crypt.lib shadow.lib s.lib socket.lib
	./ltload cvm-vchkpw libcvm-module.la -L/usr/local/vpopmail/lib -L/var/vpopmail/lib -L/usr/local/lib/mysql -lbg -lvpopmail -lmysqlclient `cat crypt.lib` `cat shadow.lib` `cat s.lib` `cat socket.lib`

cvm-vchkpw.o: compile cvm-vchkpw.c module.h credentials.h errors.h facts.h
	./compile cvm-vchkpw.c

cvm-vmailmgr: cvm-vmailmgr.o ltload vmautoconvert.o vmlookup.o getpwnam.o libcvm-module.la libcvm-qmail.la socket.lib crypt.lib
	./ltload cvm-vmailmgr vmautoconvert.o vmlookup.o getpwnam.o libcvm-module.la libcvm-qmail.la -lbg -lvmailmgr `cat socket.lib` `cat crypt.lib`

cvm-vmailmgr-local: cvm-vmailmgr-local.o ltload cvm-vmailmgr.o vmautoconvert.o vmlookup.o getpwnam.o libcvm-local.la libcvm-qmail.la socket.lib crypt.lib
	./ltload cvm-vmailmgr-local cvm-vmailmgr.o vmautoconvert.o vmlookup.o getpwnam.o libcvm-local.la libcvm-qmail.la -lbg -lvmailmgr `cat socket.lib` `cat crypt.lib`

cvm-vmailmgr-local.o: compile cvm-vmailmgr-local.c
	./compile cvm-vmailmgr-local.c

cvm-vmailmgr-udp: cvm-vmailmgr-udp.o ltload cvm-vmailmgr.o vmautoconvert.o vmlookup.o getpwnam.o libcvm-udp.la libcvm-qmail.la socket.lib crypt.lib
	./ltload cvm-vmailmgr-udp cvm-vmailmgr.o vmautoconvert.o vmlookup.o getpwnam.o libcvm-udp.la libcvm-qmail.la -lbg -lvmailmgr `cat socket.lib` `cat crypt.lib`

cvm-vmailmgr-udp.o: compile cvm-vmailmgr-udp.c
	./compile cvm-vmailmgr-udp.c

cvm-vmailmgr.o: compile cvm-vmailmgr.c module.h credentials.h errors.h facts.h qmail.h cvm-vmailmgr.h
	./compile cvm-vmailmgr.c

docs: 

errors.lo errors.o: ltcompile errors.c errors.h
	./ltcompile errors.c

facts.lo facts.o: ltcompile facts.c facts.h
	./ltcompile facts.c

getpwnam.o: compile getpwnam.c module.h credentials.h errors.h facts.h
	./compile getpwnam.c

install: INSTHIER conf-lib conf-bin conf-include
	bg-installer -v <INSTHIER
	bg-installer -c <INSTHIER

libcvm-command.la: makeshlib module_command.lo module_command_main.lo module_request.lo module_output.lo facts.lo
	./makeshlib libcvm-command.la module_command.lo module_command_main.lo module_request.lo module_output.lo facts.lo

libcvm-local.la: makeshlib module_local.lo module_local_main.lo module_request.lo module_output.lo module_log.lo facts.lo
	./makeshlib libcvm-local.la module_local.lo module_local_main.lo module_request.lo module_output.lo module_log.lo facts.lo

libcvm-module.la: makeshlib facts.lo module_command.lo module_local.lo module_log.lo module_main.lo module_output.lo module_request.lo module_udp.lo
	./makeshlib libcvm-module.la facts.lo module_command.lo module_local.lo module_log.lo module_main.lo module_output.lo module_request.lo module_udp.lo

libcvm-qmail.la: makeshlib qmail-domains.lo qmail-dotfile.lo qmail-init.lo qmail-lookup.lo qmail-users.lo
	./makeshlib libcvm-qmail.la qmail-domains.lo qmail-dotfile.lo qmail-init.lo qmail-lookup.lo qmail-users.lo

libcvm-sasl.la: makeshlib sasl_auth.lo sasl_authenticate.lo sasl_cram_md5.lo sasl_init.lo sasl_login.lo sasl_plain.lo sasl_start.lo
	./makeshlib libcvm-sasl.la sasl_auth.lo sasl_authenticate.lo sasl_cram_md5.lo sasl_init.lo sasl_login.lo sasl_plain.lo sasl_start.lo

libcvm-sql.la: makeshlib sql-auth.lo sql-query.lo
	./makeshlib libcvm-sql.la sql-auth.lo sql-query.lo

libcvm-udp.la: makeshlib module_udp.lo module_udp_main.lo module_request.lo module_output.lo module_log.lo facts.lo
	./makeshlib libcvm-udp.la module_udp.lo module_udp_main.lo module_request.lo module_output.lo module_log.lo facts.lo

libcvm-v1client.la: makeshlib v1client.lo client_domain.lo client_setugid.lo client_setenv.lo client_xfer_command.lo client_xfer_compat.lo client_xfer_local.lo client_xfer_udp.lo errors.lo facts.lo
	./makeshlib libcvm-v1client.la v1client.lo client_domain.lo client_setugid.lo client_setenv.lo client_xfer_command.lo client_xfer_compat.lo client_xfer_local.lo client_xfer_udp.lo errors.lo facts.lo

libcvm-v2client.la: makeshlib v2client.lo v2client_wrappers.lo client_domain.lo client_setugid.lo client_setenv.lo client_xfer_command.lo client_xfer_compat.lo client_xfer_local.lo client_xfer_udp.lo errors.lo facts.lo random.lo
	./makeshlib libcvm-v2client.la v2client.lo v2client_wrappers.lo client_domain.lo client_setugid.lo client_setenv.lo client_xfer_command.lo client_xfer_compat.lo client_xfer_local.lo client_xfer_udp.lo errors.lo facts.lo random.lo

libraries: libcvm-module.la libcvm-v2client.la libcvm-local.la libcvm-command.la libcvm-v1client.la libcvm-udp.la libcvm-sql.la libcvm-sasl.la libcvm-qmail.la

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

ltcompile: conf-cc
	( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \
	  echo '#!/bin/sh'; \
	  echo 'source=$$1; shift'; \
	  echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \
	  echo exec libtool --mode=compile --silent $$tag `head -n 1 conf-cc` -I.  '-o $${base}.lo -c $$source $${1+"$$@"}'; \
	) >ltcompile
	chmod 755 ltcompile

ltload: conf-ld
	( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \
	  echo '#!/bin/sh';\
	  echo 'main="$$1"; shift';\
	  echo exec libtool --mode=link --silent $$tag `head -n 1 conf-ld` -L. '-o "$$main" "$$main.o" $${1+"$$@"}' ; \
	) >ltload
	chmod 755 ltload

makeshlib: conf-ld conf-lib LIBVERSION Makefile
	( if libtool --tag=CC --help >/dev/null 2>&1; then tag='--tag=CC'; fi; \
	  echo '#!/bin/sh'; \
	  echo 'lib="$$1"; shift';\
	  echo 'rm -f "$$lib"';\
	  echo libtool --mode=link --silent $$tag `head -n 1 conf-ld` '-o "$$lib" -rpath' `head -n 1 conf-lib` -version-info `head -n 1 LIBVERSION` '$${1+"$$@"}';\
	) >makeshlib
	chmod 755 makeshlib

module_command.lo module_command.o: ltcompile module_command.c module.h credentials.h errors.h facts.h
	./ltcompile module_command.c

module_command_main.lo module_command_main.o: ltcompile module_command_main.c module.h credentials.h errors.h facts.h
	./ltcompile module_command_main.c

module_local.lo module_local.o: ltcompile module_local.c module.h credentials.h errors.h facts.h
	./ltcompile module_local.c

module_local_main.lo module_local_main.o: ltcompile module_local_main.c module.h credentials.h errors.h facts.h
	./ltcompile module_local_main.c

module_log.lo module_log.o: ltcompile module_log.c module.h credentials.h errors.h facts.h
	./ltcompile module_log.c

module_main.lo module_main.o: ltcompile module_main.c module.h credentials.h errors.h facts.h
	./ltcompile module_main.c

module_output.lo module_output.o: ltcompile module_output.c module.h credentials.h errors.h facts.h protocol.h
	./ltcompile module_output.c

module_request.lo module_request.o: ltcompile module_request.c module.h credentials.h errors.h facts.h protocol.h
	./ltcompile module_request.c

module_udp.lo module_udp.o: ltcompile module_udp.c module.h credentials.h errors.h facts.h
	./ltcompile module_udp.c

module_udp_main.lo module_udp_main.o: ltcompile module_udp_main.c module.h credentials.h errors.h facts.h
	./ltcompile module_udp_main.c

mysql: cvm-mysql cvm-mysql-local cvm-mysql-udp

pgsql: cvm-pgsql cvm-pgsql-local cvm-pgsql-udp

programs: sql-query-test cvm-checkpassword cvm-vmailmgr cvm-vmailmgr-local cvm-chain cvm-v1testclient cvm-pwfile cvm-unix cvm-testclient cvm-qmail cvm-v1checkpassword cvm-vmailmgr-udp cvm-v1benchclient sasl-auth-test cvm-benchclient

qmail-domains.lo qmail-domains.o: ltcompile qmail-domains.c qmail.h
	./ltcompile qmail-domains.c

qmail-dotfile.lo qmail-dotfile.o: ltcompile qmail-dotfile.c qmail.h
	./ltcompile qmail-dotfile.c

qmail-init.lo qmail-init.o: ltcompile qmail-init.c qmail.h
	./ltcompile qmail-init.c

qmail-lookup.lo qmail-lookup.o: ltcompile qmail-lookup.c module.h credentials.h errors.h facts.h qmail.h
	./ltcompile qmail-lookup.c

qmail-users.lo qmail-users.o: ltcompile qmail-users.c qmail.h
	./ltcompile qmail-users.c

random.lo random.o: ltcompile random.c random.h
	./ltcompile random.c

s.lib: compile load
	@echo -n 'Checking for -ls: '
	@echo 'main() { ; }' >trylib-ls.c
	@{ ./compile trylib-ls.c && ./load trylib-ls -ls; } >/dev/null 2>&1 \
	  && { echo -ls >s.lib; echo yes; } \
	  || { echo -n >s.lib; echo no; }
	@rm -f trylib-ls.c trylib-ls.o trylib-ls

sasl-auth-test: sasl-auth-test.o ltload libcvm-sasl.la libcvm-v2client.la
	./ltload sasl-auth-test libcvm-sasl.la libcvm-v2client.la -lbg 

sasl-auth-test.o: compile sasl-auth-test.c sasl.h
	./compile sasl-auth-test.c

sasl_auth.lo sasl_auth.o: ltcompile sasl_auth.c sasl.h v2client.h facts.h errors.h
	./ltcompile sasl_auth.c

sasl_authenticate.lo sasl_authenticate.o: ltcompile sasl_authenticate.c v2client.h facts.h errors.h credentials.h sasl.h sasl_internal.h
	./ltcompile sasl_authenticate.c

sasl_cram_md5.lo sasl_cram_md5.o: ltcompile sasl_cram_md5.c v2client.h facts.h errors.h sasl.h sasl_internal.h
	./ltcompile sasl_cram_md5.c

sasl_init.lo sasl_init.o: ltcompile sasl_init.c sasl.h sasl_internal.h
	./ltcompile sasl_init.c

sasl_login.lo sasl_login.o: ltcompile sasl_login.c sasl.h sasl_internal.h
	./ltcompile sasl_login.c

sasl_plain.lo sasl_plain.o: ltcompile sasl_plain.c sasl.h sasl_internal.h
	./ltcompile sasl_plain.c

sasl_start.lo sasl_start.o: ltcompile sasl_start.c sasl.h sasl_internal.h
	./ltcompile sasl_start.c

shadow.lib: compile load
	@echo -n 'Checking for -lshadow: '
	@echo 'main() { ; }' >trylib-lshadow.c
	@{ ./compile trylib-lshadow.c && ./load trylib-lshadow -lshadow; } >/dev/null 2>&1 \
	  && { echo -lshadow >shadow.lib; echo yes; } \
	  || { echo -n >shadow.lib; echo no; }
	@rm -f trylib-lshadow.c trylib-lshadow.o trylib-lshadow

socket.lib: compile load
	@echo -n 'Checking for socket libraries: '
	@echo 'main() { ; }' >trylib-lsocket.c
	@{ ./compile trylib-lsocket.c && ./load trylib-lsocket -lsocket -lnsl; } >/dev/null 2>&1 \
	  && { echo -lsocket -lnsl >socket.lib; echo -lsocket -lnsl; } \
	  || { : >socket.lib; echo no; }
	@rm -f trylib-lsocket.c trylib-lsocket.o trylib-lsocket

sql-auth.lo sql-auth.o: ltcompile sql-auth.c module.h credentials.h errors.h facts.h sql.h
	./ltcompile sql-auth.c

sql-query-test: sql-query-test.o load sql-query.o
	./load sql-query-test sql-query.o -lbg 

sql-query-test.o: compile sql-query-test.c credentials.h sql.h
	./compile sql-query-test.c

sql-query.lo sql-query.o: ltcompile sql-query.c module.h credentials.h errors.h facts.h sql.h
	./ltcompile sql-query.c

sqlite: cvm-sqlite

v1client.lo v1client.o: ltcompile v1client.c v1client.h facts.h errors.h protocol.h
	./ltcompile v1client.c

v2client.lo v2client.o: ltcompile v2client.c v2client.h facts.h errors.h credentials.h protocol.h random.h
	./ltcompile v2client.c

v2client_wrappers.lo v2client_wrappers.o: ltcompile v2client_wrappers.c v2client.h facts.h errors.h credentials.h
	./ltcompile v2client_wrappers.c

vmautoconvert.o: compile vmautoconvert.c module.h credentials.h errors.h facts.h qmail.h cvm-vmailmgr.h
	./compile vmautoconvert.c

vmlookup.o: compile vmlookup.c module.h credentials.h errors.h facts.h qmail.h cvm-vmailmgr.h
	./compile vmlookup.c

