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

SHELL=/bin/sh

default: it

alloc.a: \
makelib alloc.o alloc_re.o
	./makelib alloc.a alloc.o alloc_re.o

alloc.o: \
compile alloc.c alloc.h error.h
	./compile alloc.c

alloc_re.o: \
compile alloc_re.c alloc.h byte.h
	./compile alloc_re.c

auto-ccld.sh: \
conf-cc conf-ld warn-auto.sh
	( cat warn-auto.sh; \
	echo CC=\'`head -1 conf-cc`\'; \
	echo LD=\'`head -1 conf-ld`\' \
	) > auto-ccld.sh

auto-str: \
load auto-str.o substdio.a error.a str.a
	./load auto-str substdio.a error.a str.a 

auto-str.o: \
compile auto-str.c substdio.h readwrite.h exit.h
	./compile auto-str.c

auto_qmail.c: \
auto-str conf-qmail
	./auto-str auto_qmail `head -1 conf-qmail` > auto_qmail.c

auto_qmail.o: \
compile auto_qmail.c
	./compile auto_qmail.c

byte_chr.o: \
compile byte_chr.c byte.h
	./compile byte_chr.c

byte_copy.o: \
compile byte_copy.c byte.h
	./compile byte_copy.c

byte_cr.o: \
compile byte_cr.c byte.h
	./compile byte_cr.c

byte_diff.o: \
compile byte_diff.c byte.h
	./compile byte_diff.c

case.a: \
makelib case_diffb.o
	./makelib case.a case_diffb.o

case_diffb.o: \
compile case_diffb.c case.h
	./compile case_diffb.c

check: \
it man instcheck conf-bin conf-man
	./instcheck "`head -1 conf-bin`" < BIN
	./instcheck "`head -1 conf-man`" < MAN

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

control.o: \
compile control.c readwrite.h open.h getln.h stralloc.h gen_alloc.h \
substdio.h error.h control.h alloc.h scan.h
	./compile control.c

date822fmt.o: \
compile date822fmt.c datetime.h fmt.h date822fmt.h
	./compile date822fmt.c

datetime.a: \
makelib datetime.o
	./makelib datetime.a datetime.o

datetime.o: \
compile datetime.c datetime.h
	./compile datetime.c

direntry.h: \
compile trydrent.c direntry.h1 direntry.h2
	( ./compile trydrent.c >/dev/null 2>&1 \
	&& cat direntry.h2 || cat direntry.h1 ) > direntry.h
	rm -f trydrent.o

env.a: \
makelib envread.o
	./makelib env.a envread.o

envread.o: \
compile envread.c env.h str.h
	./compile envread.c

error.a: \
makelib error.o error_str.o
	./makelib error.a error.o error_str.o

error.o: \
compile error.c error.h
	./compile error.c

error_str.o: \
compile error_str.c error.h
	./compile error_str.c

fd.a: \
makelib fd_copy.o fd_move.o
	./makelib fd.a fd_copy.o fd_move.o

fd_copy.o: \
compile fd_copy.c fd.h
	./compile fd_copy.c

fd_move.o: \
compile fd_move.c fd.h
	./compile fd_move.c

find-systype: \
find-systype.sh auto-ccld.sh
	cat auto-ccld.sh find-systype.sh > find-systype
	chmod 755 find-systype

fmt_str.o: \
compile fmt_str.c fmt.h
	./compile fmt_str.c

fmt_strn.o: \
compile fmt_strn.c fmt.h
	./compile fmt_strn.c

fmt_uint.o: \
compile fmt_uint.c fmt.h
	./compile fmt_uint.c

fmt_uint0.o: \
compile fmt_uint0.c fmt.h
	./compile fmt_uint0.c

fmt_ulong.o: \
compile fmt_ulong.c fmt.h
	./compile fmt_ulong.c

fmt_ushort.o: \
compile fmt_ushort.c fmt.h
	./compile fmt_ushort.c

fork.h: \
compile load tryvfork.c fork.h1 fork.h2
	( ( ./compile tryvfork.c && ./load tryvfork ) >/dev/null \
	2>&1 \
	&& cat fork.h2 || cat fork.h1 ) > fork.h
	rm -f tryvfork.o tryvfork

fs.a: \
makelib fmt_str.o fmt_strn.o fmt_uint.o fmt_uint0.o fmt_ulong.o \
fmt_ushort.o scan_uint.o scan_ulong.o scan_ushort.o scan_8long.o
	./makelib fs.a fmt_str.o fmt_strn.o fmt_uint.o fmt_uint0.o \
	fmt_ulong.o fmt_ushort.o scan_uint.o scan_ulong.o \
	scan_ushort.o scan_8long.o

getln.a: \
makelib getln.o getln2.o
	./makelib getln.a getln.o getln2.o

getln.o: \
compile getln.c substdio.h byte.h stralloc.h gen_alloc.h getln.h
	./compile getln.c

getln2.o: \
compile getln2.c substdio.h stralloc.h gen_alloc.h byte.h getln.h
	./compile getln2.c

getopt.a: \
makelib subgetopt.o sgetopt.o
	./makelib getopt.a subgetopt.o sgetopt.o

hassgact.h: \
trysgact.c compile load
	( ( ./compile trysgact.c && ./load trysgact ) >/dev/null \
	2>&1 \
	&& echo \#define HASSIGACTION 1 || exit 0 ) > hassgact.h
	rm -f trysgact.o trysgact

haswaitp.h: \
trywaitp.c compile load
	( ( ./compile trywaitp.c && ./load trywaitp ) >/dev/null \
	2>&1 \
	&& echo \#define HASWAITPID 1 || exit 0 ) > haswaitp.h
	rm -f trywaitp.o trywaitp

install: \
load install.o getln.a strerr.a substdio.a stralloc.a alloc.a open.a \
error.a str.a fs.a
	./load install getln.a strerr.a substdio.a stralloc.a \
	alloc.a open.a error.a str.a fs.a 

install.o: \
compile install.c substdio.h stralloc.h gen_alloc.h getln.h \
readwrite.h exit.h open.h error.h strerr.h byte.h
	./compile install.c

instcheck: \
load instcheck.o getln.a strerr.a substdio.a stralloc.a alloc.a \
error.a str.a fs.a
	./load instcheck getln.a strerr.a substdio.a stralloc.a \
	alloc.a error.a str.a fs.a 

instcheck.o: \
compile instcheck.c substdio.h stralloc.h gen_alloc.h getln.h \
readwrite.h exit.h error.h strerr.h byte.h
	./compile instcheck.c

it: \
maildirserial serialsmtp serialqmtp maildirsmtp maildirqmtp

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

maildir.o: \
compile maildir.c prioq.h datetime.h gen_alloc.h env.h stralloc.h \
gen_alloc.h direntry.h datetime.h now.h datetime.h str.h maildir.h \
strerr.h
	./compile maildir.c

maildirqmtp: \
warn-auto.sh maildirqmtp.sh conf-bin
	cat warn-auto.sh maildirqmtp.sh \
	| sed s}BIN}"`head -1 conf-bin`"}g \
	> maildirqmtp
	chmod 755 maildirqmtp

maildirqmtp.0: \
maildirqmtp.1
	nroff -man maildirqmtp.1 > maildirqmtp.0

maildirserial: \
load maildirserial.o auto_qmail.o qmail.o now.o prioq.o maildir.o \
control.o quote.o date822fmt.o datetime.a env.a fd.a sig.a wait.a \
getopt.a strerr.a open.a getln.a stralloc.a alloc.a substdio.a \
error.a str.a fs.a
	./load maildirserial auto_qmail.o qmail.o now.o prioq.o \
	maildir.o control.o quote.o date822fmt.o datetime.a env.a \
	fd.a sig.a wait.a getopt.a strerr.a open.a getln.a \
	stralloc.a alloc.a substdio.a error.a str.a fs.a 

maildirserial.0: \
maildirserial.1
	nroff -man maildirserial.1 > maildirserial.0

maildirserial.o: \
compile maildirserial.c sgetopt.h subgetopt.h scan.h stralloc.h \
gen_alloc.h fd.h open.h getln.h subfd.h substdio.h strerr.h \
substdio.h readwrite.h maildir.h strerr.h prioq.h datetime.h \
gen_alloc.h wait.h fork.h sig.h now.h datetime.h str.h fmt.h \
date822fmt.h control.h qmail.h substdio.h auto_qmail.h
	./compile maildirserial.c

maildirsmtp: \
warn-auto.sh maildirsmtp.sh conf-bin
	cat warn-auto.sh maildirsmtp.sh \
	| sed s}BIN}"`head -1 conf-bin`"}g \
	> maildirsmtp
	chmod 755 maildirsmtp

maildirsmtp.0: \
maildirsmtp.1
	nroff -man maildirsmtp.1 > maildirsmtp.0

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

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

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

man: \
maildirserial.0 serialsmtp.0 serialqmtp.0 maildirsmtp.0 maildirqmtp.0

now.o: \
compile now.c datetime.h now.h datetime.h
	./compile now.c

open.a: \
makelib open_read.o open_trunc.o
	./makelib open.a open_read.o open_trunc.o

open_read.o: \
compile open_read.c open.h
	./compile open_read.c

open_trunc.o: \
compile open_trunc.c open.h
	./compile open_trunc.c

prioq.o: \
compile prioq.c alloc.h gen_allocdefs.h prioq.h datetime.h \
gen_alloc.h
	./compile prioq.c

qmail.o: \
compile qmail.c substdio.h readwrite.h wait.h exit.h fork.h fd.h \
qmail.h substdio.h auto_qmail.h
	./compile qmail.c

quote.o: \
compile quote.c stralloc.h gen_alloc.h str.h quote.h
	./compile quote.c

scan_8long.o: \
compile scan_8long.c scan.h
	./compile scan_8long.c

scan_uint.o: \
compile scan_uint.c scan.h
	./compile scan_uint.c

scan_ulong.o: \
compile scan_ulong.c scan.h
	./compile scan_ulong.c

scan_ushort.o: \
compile scan_ushort.c scan.h
	./compile scan_ushort.c

select.h: \
compile trysysel.c select.h1 select.h2
	( ./compile trysysel.c >/dev/null 2>&1 \
	&& cat select.h2 || cat select.h1 ) > select.h
	rm -f trysysel.o trysysel

serialqmtp: \
load serialqmtp.o timeoutread.o timeoutwrite.o open.a env.a wait.a \
fd.a sig.a strerr.a getln.a substdio.a stralloc.a alloc.a error.a \
str.a fs.a socket.lib
	./load serialqmtp timeoutread.o timeoutwrite.o open.a \
	env.a wait.a fd.a sig.a strerr.a getln.a substdio.a \
	stralloc.a alloc.a error.a str.a fs.a  `cat socket.lib`

serialqmtp.0: \
serialqmtp.1
	nroff -man serialqmtp.1 > serialqmtp.0

serialqmtp.o: \
compile serialqmtp.c strerr.h getln.h substdio.h stralloc.h \
gen_alloc.h subfd.h substdio.h readwrite.h sig.h timeoutread.h \
timeoutwrite.h fd.h fork.h exit.h open.h wait.h str.h fmt.h env.h
	./compile serialqmtp.c

serialsmtp: \
load serialsmtp.o timeoutread.o timeoutwrite.o quote.o open.a case.a \
env.a wait.a fd.a sig.a strerr.a getln.a substdio.a stralloc.a \
alloc.a error.a str.a fs.a socket.lib
	./load serialsmtp timeoutread.o timeoutwrite.o quote.o \
	open.a case.a env.a wait.a fd.a sig.a strerr.a getln.a \
	substdio.a stralloc.a alloc.a error.a str.a fs.a  `cat \
	socket.lib`

serialsmtp.0: \
serialsmtp.1
	nroff -man serialsmtp.1 > serialsmtp.0

serialsmtp.o: \
compile serialsmtp.c strerr.h getln.h subfd.h substdio.h substdio.h \
readwrite.h open.h timeoutread.h timeoutwrite.h exit.h stralloc.h \
gen_alloc.h sig.h str.h case.h quote.h scan.h env.h
	./compile serialsmtp.c

setup: \
it man install conf-bin conf-man
	./install "`head -1 conf-bin`" < BIN
	./install "`head -1 conf-man`" < MAN

sgetopt.o: \
compile sgetopt.c substdio.h subfd.h substdio.h sgetopt.h subgetopt.h \
subgetopt.h
	./compile sgetopt.c

shar: \
FILES BLURB README TODO THANKS CHANGES FILES VERSION SYSDEPS Makefile \
INSTALL serialqmtp.1 serialqmtp.c serialsmtp.1 serialsmtp.c \
maildirserial.1 maildirserial.c conf-bin conf-man auto-str.c \
auto-int.c auto-int8.c auto-uid.c auto-gid.c install.c instcheck.c \
conf-cc conf-ld find-systype.sh make-compile.sh make-load.sh \
make-makelib.sh trycpp.c warn-auto.sh alloc.h alloc.c alloc_re.c \
byte.h byte_chr.c byte_copy.c byte_cr.c byte_diff.c str.h str_cpy.c \
str_diff.c str_diffn.c str_len.c str_rchr.c case.h case_diffb.c \
control.h control.c date822fmt.h date822fmt.c datetime.h datetime.c \
direntry.h1 direntry.h2 trydrent.c env.h envread.c error.h error.c \
error_str.c fd.h fd_copy.c fd_move.c fmt.h fmt_str.c fmt_strn.c \
fmt_uint.c fmt_uint0.c fmt_ulong.c fmt_ushort.c scan.h scan_uint.c \
scan_ulong.c scan_ushort.c scan_8long.c fork.h1 fork.h2 tryvfork.c \
getln.h getln.c getln2.c maildir.5 maildir.h maildir.c now.h now.c \
open.h open_read.c open_trunc.c prioq.h prioq.c conf-qmail \
auto_qmail.h qmail.h qmail.c quote.h quote.c select.h1 select.h2 \
trysysel.c sig.h sig_catch.c sig_pipe.c trysgact.c gen_alloc.h \
gen_allocdefs.h stralloc.h stralloc_eady.c stralloc_pend.c \
stralloc_copy.c stralloc_opyb.c stralloc_opys.c stralloc_cat.c \
stralloc_catb.c stralloc_cats.c stralloc_arts.c strerr.h strerr_sys.c \
strerr_die.c substdio.h substdio.c substdi.c substdo.c \
substdio_copy.c subfd.h subfderr.c subfdouts.c subfdins.c readwrite.h \
exit.h timeoutread.h timeoutread.c timeoutwrite.h timeoutwrite.c \
wait.h wait_pid.c trywaitp.c sgetopt.h sgetopt.c subgetopt.h \
subgetopt.c
	shar -m `cat FILES` > shar
	chmod 400 shar

sig.a: \
makelib sig_catch.o sig_pipe.o
	./makelib sig.a sig_catch.o sig_pipe.o

sig_catch.o: \
compile sig_catch.c sig.h hassgact.h
	./compile sig_catch.c

sig_pipe.o: \
compile sig_pipe.c sig.h
	./compile sig_pipe.c

socket.lib: \
trylsock.c compile load
	( ( ./compile trylsock.c && \
	./load trylsock -lsocket -lnsl ) >/dev/null 2>&1 \
	&& echo -lsocket -lnsl || exit 0 ) > socket.lib
	rm -f trylsock.o trylsock

str.a: \
makelib str_len.o str_diff.o str_diffn.o str_cpy.o str_rchr.o \
byte_chr.o byte_diff.o byte_copy.o byte_cr.o
	./makelib str.a str_len.o str_diff.o str_diffn.o str_cpy.o \
	str_rchr.o byte_chr.o byte_diff.o byte_copy.o byte_cr.o

str_cpy.o: \
compile str_cpy.c str.h
	./compile str_cpy.c

str_diff.o: \
compile str_diff.c str.h
	./compile str_diff.c

str_diffn.o: \
compile str_diffn.c str.h
	./compile str_diffn.c

str_len.o: \
compile str_len.c str.h
	./compile str_len.c

str_rchr.o: \
compile str_rchr.c str.h
	./compile str_rchr.c

stralloc.a: \
makelib stralloc_eady.o stralloc_pend.o stralloc_copy.o \
stralloc_opys.o stralloc_opyb.o stralloc_cat.o stralloc_cats.o \
stralloc_catb.o stralloc_arts.o
	./makelib stralloc.a stralloc_eady.o stralloc_pend.o \
	stralloc_copy.o stralloc_opys.o stralloc_opyb.o \
	stralloc_cat.o stralloc_cats.o stralloc_catb.o \
	stralloc_arts.o

stralloc_arts.o: \
compile stralloc_arts.c byte.h str.h stralloc.h gen_alloc.h
	./compile stralloc_arts.c

stralloc_cat.o: \
compile stralloc_cat.c byte.h stralloc.h gen_alloc.h
	./compile stralloc_cat.c

stralloc_catb.o: \
compile stralloc_catb.c stralloc.h gen_alloc.h byte.h
	./compile stralloc_catb.c

stralloc_cats.o: \
compile stralloc_cats.c byte.h str.h stralloc.h gen_alloc.h
	./compile stralloc_cats.c

stralloc_copy.o: \
compile stralloc_copy.c byte.h stralloc.h gen_alloc.h
	./compile stralloc_copy.c

stralloc_eady.o: \
compile stralloc_eady.c alloc.h stralloc.h gen_alloc.h \
gen_allocdefs.h
	./compile stralloc_eady.c

stralloc_opyb.o: \
compile stralloc_opyb.c stralloc.h gen_alloc.h byte.h
	./compile stralloc_opyb.c

stralloc_opys.o: \
compile stralloc_opys.c byte.h str.h stralloc.h gen_alloc.h
	./compile stralloc_opys.c

stralloc_pend.o: \
compile stralloc_pend.c alloc.h stralloc.h gen_alloc.h \
gen_allocdefs.h
	./compile stralloc_pend.c

strerr.a: \
makelib strerr_sys.o strerr_die.o
	./makelib strerr.a strerr_sys.o strerr_die.o

strerr_die.o: \
compile strerr_die.c substdio.h subfd.h substdio.h exit.h strerr.h
	./compile strerr_die.c

strerr_sys.o: \
compile strerr_sys.c error.h strerr.h
	./compile strerr_sys.c

subfderr.o: \
compile subfderr.c readwrite.h substdio.h subfd.h substdio.h
	./compile subfderr.c

subfdins.o: \
compile subfdins.c readwrite.h substdio.h subfd.h substdio.h
	./compile subfdins.c

subfdouts.o: \
compile subfdouts.c readwrite.h substdio.h subfd.h substdio.h
	./compile subfdouts.c

subgetopt.o: \
compile subgetopt.c subgetopt.h
	./compile subgetopt.c

substdi.o: \
compile substdi.c substdio.h byte.h error.h
	./compile substdi.c

substdio.a: \
makelib substdio.o substdi.o substdo.o subfderr.o subfdouts.o \
subfdins.o substdio_copy.o
	./makelib substdio.a substdio.o substdi.o substdo.o \
	subfderr.o subfdouts.o subfdins.o substdio_copy.o

substdio.o: \
compile substdio.c substdio.h
	./compile substdio.c

substdio_copy.o: \
compile substdio_copy.c substdio.h
	./compile substdio_copy.c

substdo.o: \
compile substdo.c substdio.h str.h byte.h error.h
	./compile substdo.c

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

timeoutread.o: \
compile timeoutread.c timeoutread.h select.h error.h readwrite.h
	./compile timeoutread.c

timeoutwrite.o: \
compile timeoutwrite.c timeoutwrite.h select.h error.h readwrite.h
	./compile timeoutwrite.c

wait.a: \
makelib wait_pid.o
	./makelib wait.a wait_pid.o

wait_pid.o: \
compile wait_pid.c error.h haswaitp.h
	./compile wait_pid.c
