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

SHELL=/bin/sh

default: it


it: prog install instcheck

load: warn-auto.sh conf-ld
	( cat warn-auto.sh; \
	echo 'main="$$1"; shift'; \
	echo exec "`head -1 conf-ld`" \
	'-o "$$main" "$$main".o $${1+"$$@"}' \
	) > load
	chmod 755 load

prog: auto-str auto-int8 checkpw checkapoppw \
selectcheckpw loginlog \
run-pop run-apop run-rules run-both run-multidir run-multipw

auto_patrn.c: auto-int8 conf-patrn
	./auto-int8 auto_patrn `head -1 conf-patrn` > auto_patrn.c

auto_patrn.o: compile \
auto_patrn.c
	./compile auto_patrn.c

compile: warn-auto.sh conf-cc
	( cat warn-auto.sh; \
	echo exec "`head -1 conf-cc`" '-c $${1+"$$@"}' \
	) > compile
	chmod 755 compile

checkapoppw.o: compile \
checkapoppw.c \
error.h pathexec.h prot.h stralloc.h gen_alloc.h openreadclose.h env.h \
global.h md5.h auto_maildir.h auto_password.h auto_patrn.h
	./compile checkapoppw.c

check: it instcheck
	./instcheck

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

auto_password.c: auto-str conf-password
	./auto-str auto_password `head -1 conf-password` > auto_password.c

auto_password.o: compile \
auto_password.c
	./compile auto_password.c

setup: it install
	./install

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

selectcheckpw: warn-auto.sh selectcheckpw.sh conf-home
	cat warn-auto.sh selectcheckpw.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> selectcheckpw
	chmod 755 selectcheckpw

auto_home.c: auto-str conf-home
	./auto-str auto_home `head -1 conf-home` > auto_home.c

auto_home.o: compile \
auto_home.c
	./compile auto_home.c

checkapoppw: load checkapoppw.o auto_maildir.o auto_password.o \
auto_patrn.o md5c.o unix.a byte.a
	./load checkapoppw auto_maildir.o auto_password.o auto_patrn.o md5c.o \
	unix.a byte.a 

auto-str: load auto-str.o unix.a byte.a
	./load auto-str unix.a byte.a 

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

run-multidir: warn-auto.sh run-multidir.sh conf-home
	cat warn-auto.sh run-multidir.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-multidir
	chmod 755 run-multidir

run-pop: warn-auto.sh run-pop.sh conf-home
	cat warn-auto.sh run-pop.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-pop
	chmod 755 run-pop

makelib: warn-auto.sh systype
	( cat warn-auto.sh; \
	echo 'main="$$1"; shift'; \
	echo 'rm -f "$$main"'; \
	echo 'ar cr "$$main" $${1+"$$@"}'; \
	case "`cat systype`" in \
	sunos-5.*) ;; \
	unix_sv*) ;; \
	irix64-*) ;; \
	irix-*) ;; \
	dgux-*) ;; \
	hp-ux-*) ;; \
	sco*) ;; \
	*) echo 'ranlib "$$main"' ;; \
	esac \
	) > makelib
	chmod 755 makelib

openreadclose.o: compile \
openreadclose.c \
error.h open.h readclose.h stralloc.h gen_alloc.h openreadclose.h
	./compile openreadclose.c

run-apop: warn-auto.sh run-apop.sh conf-home
	cat warn-auto.sh run-apop.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-apop
	chmod 755 run-apop

run-both: warn-auto.sh run-both.sh conf-home
	cat warn-auto.sh run-both.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-both
	chmod 755 run-both

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

instcheck.o: compile \
instcheck.c \
strerr.h error.h readwrite.h exit.h
	./compile instcheck.c

auto_maildir.c: auto-str conf-maildir
	./auto-str auto_maildir `head -1 conf-maildir` > auto_maildir.c

auto_maildir.o: compile \
auto_maildir.c
	./compile auto_maildir.c

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

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

strerr_die.o: compile \
strerr_die.c \
buffer.h exit.h strerr.h
	./compile strerr_die.c

buffer_get.o: compile \
buffer_get.c \
buffer.h byte.h error.h
	./compile buffer_get.c

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

buffer_put.o: compile \
buffer_put.c \
buffer.h str.h byte.h error.h
	./compile buffer_put.c

strerr_sys.o: compile \
strerr_sys.c \
error.h strerr.h
	./compile strerr_sys.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

buffer_copy.o: compile \
buffer_copy.c \
buffer.h
	./compile buffer_copy.c

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

byte.a: makelib byte_copy.o byte_cr.o byte_diff.o str_chr.o str_len.o \
str_start.o
	./makelib byte.a byte_copy.o byte_cr.o byte_diff.o str_chr.o str_len.o \
	str_start.o

run-multipw: warn-auto.sh run-multipw.sh conf-home
	cat warn-auto.sh run-multipw.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-multipw
	chmod 755 run-multipw

pathexec_env.o: compile \
pathexec_env.c \
stralloc.h gen_alloc.h alloc.h str.h byte.h env.h pathexec.h
	./compile pathexec_env.c

systype: find-systype.sh conf-cc conf-ld trycpp.c x86cpuid.c
	( cat warn-auto.sh; \
	echo CC=\'`head -1 conf-cc`\'; \
	echo LD=\'`head -1 conf-ld`\'; \
	cat find-systype.sh; \
	) | sh > systype

hier.o: compile \
hier.c \
auto_home.h
	./compile hier.c

pathexec_run.o: compile \
pathexec_run.c \
error.h stralloc.h gen_alloc.h str.h env.h pathexec.h
	./compile pathexec_run.c

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

md5c.o: compile \
md5c.c \
global.h md5.h
	./compile md5c.c

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

stralloc_pend.o: compile \
stralloc_pend.c \
alloc.h stralloc.h gen_alloc.h gen_allocdefs.h
	./compile stralloc_pend.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

prot.o: compile \
prot.c \
hasshsgr.h prot.h
	./compile prot.c

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

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

auto-int8: load auto-int8.o unix.a byte.a
	./load auto-int8 unix.a byte.a 

unix.a: makelib alloc.o alloc_re.o buffer.o buffer_2.o buffer_copy.o \
buffer_get.o buffer_put.o env.o error.o error_str.o open_read.o \
open_trunc.o openreadclose.o readclose.o pathexec_env.o pathexec_run.o \
prot.o stralloc_cat.o stralloc_catb.o stralloc_cats.o stralloc_eady.o \
stralloc_opyb.o stralloc_opys.o stralloc_pend.o strerr_die.o strerr_sys.o \
substdo.o scan_8long.o fmt_ulong.o
	./makelib unix.a alloc.o alloc_re.o buffer.o buffer_2.o buffer_copy.o \
	buffer_get.o buffer_put.o env.o error.o error_str.o open_read.o \
	open_trunc.o openreadclose.o readclose.o pathexec_env.o pathexec_run.o \
	prot.o stralloc_cat.o stralloc_catb.o stralloc_cats.o stralloc_eady.o \
	stralloc_opyb.o stralloc_opys.o stralloc_pend.o strerr_die.o \
	strerr_sys.o substdo.o scan_8long.o fmt_ulong.o

checkpw.o: compile \
checkpw.c \
error.h pathexec.h prot.h stralloc.h gen_alloc.h openreadclose.h env.h \
auto_maildir.h auto_password.h auto_patrn.h
	./compile checkpw.c

readclose.o: compile \
readclose.c \
error.h readclose.h stralloc.h gen_alloc.h
	./compile readclose.c

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

loginlog: warn-auto.sh loginlog.sh conf-home
	cat warn-auto.sh loginlog.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> loginlog
	chmod 755 loginlog

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

run-rules: warn-auto.sh run-rules.sh conf-home
	cat warn-auto.sh run-rules.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	| sed s}QMAIL}"`head -1 conf-qmail`"}g \
	| sed s}MAILDIR}"`head -1 conf-maildir`"}g \
	> run-rules
	chmod 755 run-rules

buffer_2.o: compile \
buffer_2.c \
readwrite.h buffer.h
	./compile buffer_2.c

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

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

install: load install.o hier.o auto_home.o unix.a byte.a
	./load install hier.o auto_home.o unix.a byte.a 

auto-int8.o: compile \
auto-int8.c \
substdio.h readwrite.h exit.h scan.h fmt.h
	./compile auto-int8.c

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

checkpw: load checkpw.o auto_maildir.o auto_password.o auto_patrn.o \
unix.a byte.a
	./load checkpw auto_maildir.o auto_password.o auto_patrn.o unix.a byte.a \
	

install.o: compile \
install.c \
buffer.h strerr.h error.h open.h readwrite.h exit.h
	./compile install.c

instcheck: load instcheck.o hier.o auto_home.o unix.a byte.a
	./load instcheck hier.o auto_home.o unix.a byte.a 

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

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

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