default: it

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

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

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

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

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

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

cdb_hash.o: \
compile cdb_hash.c cdb.h uint32.h cdb.h cdb_hash.c
	./compile cdb_hash.c

cdb_seek.o: \
compile cdb_seek.c cdb_seek.c cdb_seek.c cdb.h uint32.h cdb.h \
cdb_seek.c
	./compile cdb_seek.c

cdb_unpack.o: \
compile cdb_unpack.c cdb.h uint32.h cdb.h cdb_unpack.c
	./compile cdb_unpack.c

cdbmake_add.o: \
compile cdbmake_add.c cdbmake.h uint32.h cdbmake.h cdbmake_add.c
	./compile cdbmake_add.c

cdbmake_hash.o: \
compile cdbmake_hash.c cdbmake.h uint32.h cdbmake.h cdbmake_hash.c
	./compile cdbmake_hash.c

cdbmake_pack.o: \
compile cdbmake_pack.c cdbmake.h uint32.h cdbmake.h cdbmake_pack.c
	./compile cdbmake_pack.c

compile: \
make-commands systype
	./make-commands "`cat ./systype`" compile > compile
	chmod 755 compile

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

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

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

find-systype: \
find-systype.sh conf-cc.sh warn-auto.sh
	cat warn-auto.sh conf-cc.sh find-systype.sh > find-systype
	chmod 755 find-systype

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

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

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

getline2.o: \
compile getline2.c substdio.h getline2.c byte.h getline2.c stralloc.h \
gen_alloc.h stralloc.h getline2.c alloc.h getline2.c getline.h \
getline2.c
	./compile getline2.c

it: \
tcpcontrol tcpmakectl tcpcontrol.0 tcpmakectl.0 tcprules.0 \
tcp-environ.0

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

libcdb.a: \
makelib cdb_hash.o cdb_unpack.o cdb_seek.o
	./makelib libcdb.a cdb_hash.o cdb_unpack.o cdb_seek.o

libcdbmake.a: \
makelib cdbmake_pack.o cdbmake_hash.o cdbmake_add.o
	./makelib libcdbmake.a cdbmake_pack.o cdbmake_hash.o \
	cdbmake_add.o

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

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

libfs.a: \
makelib fmt_str.o fmt_ulong.o
	./makelib libfs.a fmt_str.o fmt_ulong.o

libgetline.a: \
makelib getline.o getline2.o
	./makelib libgetline.a getline.o getline2.o

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

libseek.a: \
makelib seek_set.o
	./makelib libseek.a seek_set.o

libstr.a: \
makelib str_len.o str_diff.o str_diffn.o str_cpy.o str_chr.o \
byte_chr.o byte_diff.o byte_copy.o byte_cr.o
	./makelib libstr.a str_len.o str_diff.o str_diffn.o \
	str_cpy.o str_chr.o byte_chr.o byte_diff.o byte_copy.o \
	byte_cr.o

libstralloc.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
	./makelib libstralloc.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

libsubstdio.a: \
makelib substdio.o substdi.o substdo.o subfderr.o \
subfdout.o subfdin.o
	./makelib libsubstdio.a substdio.o substdi.o substdo.o \
	subfderr.o subfdout.o subfdin.o

load: \
make-commands systype
	./make-commands "`cat ./systype`" load > load
	chmod 755 load

make-commands: \
make-cmds.sh conf-cc.sh warn-auto.sh
	cat warn-auto.sh conf-cc.sh make-cmds.sh > make-commands
	chmod 755 make-commands

makelib: \
make-commands systype
	./make-commands "`cat ./systype`" makelib > makelib
	chmod 755 makelib

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

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

seek_set.o: \
compile seek_set.c seek_set.c seek.h seek_set.c
	./compile seek_set.c

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

tcp-environ.0: \
tcp-environ.5
	nroff -man tcp-environ.5 > tcp-environ.0

tcpcontrol: \
load tcpcontrol.o libcdb.a libsubstdio.a libenv.a \
liballoc.a liberror.a libfs.a libstr.a libopen.a
	./load tcpcontrol libcdb.a libsubstdio.a libenv.a \
	liballoc.a liberror.a libfs.a libstr.a libopen.a

tcpcontrol.0: \
tcpcontrol.8
	nroff -man tcpcontrol.8 > tcpcontrol.0

tcpcontrol.o: \
compile tcpcontrol.c substdio.h tcpcontrol.c subfd.h tcpcontrol.c \
alloc.h tcpcontrol.c env.h tcpcontrol.c str.h tcpcontrol.c fmt.h \
tcpcontrol.c open.h tcpcontrol.c readwrite.h tcpcontrol.c exit.h \
tcpcontrol.c cdb.h uint32.h cdb.h tcpcontrol.c
	./compile tcpcontrol.c

tcpmakectl: \
load tcpmakectl.o libcdbmake.a libgetline.a \
libsubstdio.a libstralloc.a liballoc.a liberror.a libstr.a libseek.a \
libopen.a
	./load tcpmakectl libcdbmake.a libgetline.a libsubstdio.a \
	libstralloc.a liballoc.a liberror.a libstr.a libseek.a \
	libopen.a

tcpmakectl.0: \
tcpmakectl.8
	nroff -man tcpmakectl.8 > tcpmakectl.0

tcpmakectl.o: \
compile tcpmakectl.c stralloc.h gen_alloc.h stralloc.h tcpmakectl.c \
substdio.h tcpmakectl.c subfd.h tcpmakectl.c readwrite.h tcpmakectl.c \
exit.h tcpmakectl.c byte.h tcpmakectl.c cdbmake.h uint32.h cdbmake.h \
tcpmakectl.c alloc.h tcpmakectl.c seek.h tcpmakectl.c
	./compile tcpmakectl.c

tcprules.0: \
tcprules.5
	nroff -man tcprules.5 > tcprules.0

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