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

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

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

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

caldate_fmjd.o: \
compile caldate_fmjd.c caldate.h
	./compile caldate_fmjd.c

caltime_utc.o: \
compile caltime_utc.c tai.h uint64.h leapsecs.h caldate.h caltime.h \
caldate.h
	./compile caltime_utc.c

case.a: \
makelib case_diffs.o case_lowerb.o case_startb.o
	./makelib case.a case_diffs.o case_lowerb.o case_startb.o

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

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

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

check: \
it instcheck
	./instcheck

chkshsgr: \
load chkshsgr.o
	./load chkshsgr 

chkshsgr.o: \
compile chkshsgr.c exit.h
	./compile chkshsgr.c

choose: \
warn-auto.sh choose.sh conf-home
	cat warn-auto.sh choose.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	> choose
	chmod 755 choose

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

configure: \
load configure.o auto_home.o strerr.a substdio.a error.a open.a str.a
	./load configure auto_home.o strerr.a substdio.a error.a \
	open.a str.a 

configure.o: \
compile configure.c hasdevtcp.h strerr.h substdio.h open.h \
readwrite.h exit.h auto_home.h
	./compile configure.c

direntry.h: \
choose compile trydrent.c direntry.h1 direntry.h2
	./choose c trydrent direntry.h1 direntry.h2 > direntry.h

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

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

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

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

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

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

fetch.o: \
compile fetch.c substdio.h timeoutwrite.h error.h exit.h direntry.h \
fmt.h fetch.h
	./compile fetch.c

file.o: \
compile file.c subfd.h substdio.h error.h file.h tai.h uint64.h \
byte.h str.h tai.h env.h
	./compile file.c

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

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

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

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

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

fs.a: \
makelib fmt_str.o fmt_uint.o fmt_ulong.o fmt_xlong.o scan_ulong.o
	./makelib fs.a fmt_str.o fmt_uint.o fmt_ulong.o \
	fmt_xlong.o scan_ulong.o

ftpd: \
load ftpd.o main.o prot.o pathdecode.o file.o fetch.o ip.o \
timeoutread.o timeoutwrite.o timeoutconn.o timeoutaccept.o ndelay.a \
env.a sig.a substdio.a stralloc.a alloc.a error.a open.a case.a str.a \
fs.a socket.lib
	./load ftpd main.o prot.o pathdecode.o file.o fetch.o ip.o \
	timeoutread.o timeoutwrite.o timeoutconn.o timeoutaccept.o \
	ndelay.a env.a sig.a substdio.a stralloc.a alloc.a error.a \
	open.a case.a str.a fs.a  `cat socket.lib`

ftpd.o: \
compile ftpd.c timeoutconn.h timeoutaccept.h timeoutread.h \
timeoutwrite.h substdio.h fetch.h pathdecode.h stralloc.h gen_alloc.h \
file.h tai.h uint64.h sig.h tai.h stralloc.h str.h error.h case.h \
byte.h env.h fmt.h scan.h ip.h
	./compile ftpd.c

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

hasdevtcp.h: \
systype hasdevtcp.h1 hasdevtcp.h2
	( case "`cat systype`" in \
	  sunos-5.*) cat hasdevtcp.h2 ;; \
	  *) cat hasdevtcp.h1 ;; \
	esac ) > hasdevtcp.h

hassgact.h: \
choose compile load trysgact.c hassgact.h1 hassgact.h2
	./choose cl trysgact hassgact.h1 hassgact.h2 > hassgact.h

hassgprm.h: \
choose compile load trysgprm.c hassgprm.h1 hassgprm.h2
	./choose cl trysgprm hassgprm.h1 hassgprm.h2 > hassgprm.h

hasshsgr.h: \
choose compile load tryshsgr.c hasshsgr.h1 hasshsgr.h2 chkshsgr \
warn-shsgr
	./chkshsgr || ( cat warn-shsgr; exit 1 )
	./choose clr tryshsgr hasshsgr.h1 hasshsgr.h2 > hasshsgr.h

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

httpd: \
load httpd.o main.o pathdecode.o file.o filetype.o httpdate.o \
percent.o prot.o timeoutread.o timeoutwrite.o libtai.a case.a getln.a \
stralloc.a alloc.a substdio.a error.a open.a sig.a env.a str.a fs.a \
socket.lib
	./load httpd main.o pathdecode.o file.o filetype.o \
	httpdate.o percent.o prot.o timeoutread.o timeoutwrite.o \
	libtai.a case.a getln.a stralloc.a alloc.a substdio.a \
	error.a open.a sig.a env.a str.a fs.a  `cat socket.lib`

httpd.o: \
compile httpd.c pathdecode.h stralloc.h gen_alloc.h file.h tai.h \
uint64.h filetype.h stralloc.h percent.h stralloc.h stralloc.h sig.h \
exit.h fmt.h case.h str.h tai.h httpdate.h stralloc.h tai.h \
timeoutread.h timeoutwrite.h substdio.h error.h getln.h
	./compile httpd.c

httpdate.o: \
compile httpdate.c caltime.h caldate.h httpdate.h stralloc.h \
gen_alloc.h tai.h uint64.h
	./compile httpdate.c

install: \
load install.o hier.o auto_home.o strerr.a substdio.a open.a error.a \
str.a
	./load install hier.o auto_home.o strerr.a substdio.a \
	open.a error.a str.a 

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

instcheck: \
load instcheck.o hier.o auto_home.o strerr.a substdio.a error.a str.a
	./load instcheck hier.o auto_home.o strerr.a substdio.a \
	error.a str.a 

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

ip.o: \
compile ip.c fmt.h scan.h ip.h
	./compile ip.c

it: \
prog install instcheck

leapsecs_init.o: \
compile leapsecs_init.c leapsecs.h
	./compile leapsecs_init.c

leapsecs_read.o: \
compile leapsecs_read.c tai.h uint64.h leapsecs.h
	./compile leapsecs_read.c

leapsecs_sub.o: \
compile leapsecs_sub.c leapsecs.h tai.h uint64.h
	./compile leapsecs_sub.c

libtai.a: \
makelib caldate_fmjd.o caltime_utc.o leapsecs_init.o leapsecs_read.o \
leapsecs_sub.o tai_now.o tai_sub.o tai_unpack.o
	./makelib libtai.a caldate_fmjd.o caltime_utc.o \
	leapsecs_init.o leapsecs_read.o leapsecs_sub.o tai_now.o \
	tai_sub.o tai_unpack.o

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

main.o: \
compile main.c env.h exit.h scan.h
	./compile main.c

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

ndelay.a: \
makelib ndelay_on.o ndelay_off.o
	./makelib ndelay.a ndelay_on.o ndelay_off.o

ndelay_off.o: \
compile ndelay_off.c ndelay.h
	./compile ndelay_off.c

ndelay_on.o: \
compile ndelay_on.c ndelay.h
	./compile ndelay_on.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

pathdecode.o: \
compile pathdecode.c pathdecode.h stralloc.h gen_alloc.h
	./compile pathdecode.c

percent.o: \
compile percent.c percent.h stralloc.h gen_alloc.h
	./compile percent.c

prog: \
configure httpd ftpd rts utime

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

rts: \
warn-auto.sh rts.sh conf-home
	cat warn-auto.sh rts.sh \
	| sed s}HOME}"`head -1 conf-home`"}g \
	> rts
	chmod 755 rts

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

select.h: \
choose compile trysysel.c select.h1 select.h2
	./choose c trysysel select.h1 select.h2 > select.h

setup: \
it install
	./install

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

sig_block.o: \
compile sig_block.c sig.h hassgprm.h
	./compile sig_block.c

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

sig_pause.o: \
compile sig_pause.c sig.h hassgprm.h
	./compile sig_pause.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 byte_chr.o byte_copy.o byte_cr.o byte_diff.o byte_rchr.o \
byte_zero.o str_chr.o str_diff.o str_len.o str_rchr.o str_start.o
	./makelib str.a byte_chr.o byte_copy.o byte_cr.o \
	byte_diff.o byte_rchr.o byte_zero.o str_chr.o str_diff.o \
	str_len.o str_rchr.o str_start.o

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

str_diff.o: \
compile str_diff.c str.h
	./compile str_diff.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

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

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

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_num.o: \
compile stralloc_num.c stralloc.h gen_alloc.h
	./compile stralloc_num.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_die.o strerr_sys.o
	./makelib strerr.a strerr_die.o strerr_sys.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

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

substdio.a: \
makelib substdio.o substdi.o substdo.o substdio_copy.o subfderr.o
	./makelib substdio.a substdio.o substdi.o substdo.o \
	substdio_copy.o subfderr.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.sh conf-cc conf-ld trycpp.c
	( cat warn-auto.sh; \
	echo CC=\'`head -1 conf-cc`\'; \
	echo LD=\'`head -1 conf-ld`\'; \
	cat find-systype.sh; \
	) | sh > systype

tai_now.o: \
compile tai_now.c tai.h uint64.h
	./compile tai_now.c

tai_sub.o: \
compile tai_sub.c tai.h uint64.h
	./compile tai_sub.c

tai_unpack.o: \
compile tai_unpack.c tai.h uint64.h
	./compile tai_unpack.c

timeoutaccept.o: \
compile timeoutaccept.c timeoutaccept.h ndelay.h select.h error.h \
readwrite.h
	./compile timeoutaccept.c

timeoutconn.o: \
compile timeoutconn.c ndelay.h select.h error.h readwrite.h ip.h \
byte.h timeoutconn.h
	./compile timeoutconn.c

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

uint64.h: \
choose compile load tryulong64.c uint64.h1 uint64.h2
	./choose clr tryulong64 uint64.h1 uint64.h2 > uint64.h

utime: \
load utime.o fs.a
	./load utime fs.a 

utime.o: \
compile utime.c scan.h exit.h
	./compile utime.c
