# 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

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

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

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

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

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

fs.a: \
makelib scan_ulong.o scan_8long.o
	./makelib fs.a scan_ulong.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

gmp.lib: \

	echo -lgmp > gmp.lib

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: \
secretkey publickey sign secretjudge verify prove match predictable

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

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: \


match: \
load match.o snefru.a error.a str.a
	./load match snefru.a error.a str.a 

match.o: \
compile match.c error.h snefrufile.h byte.h
	./compile match.c

mpz_bytes.o: \
compile mpz_bytes.c mpz_bytes.h uint32.h endian.h byte.h
	./compile mpz_bytes.c

mpz_words.o: \
compile mpz_words.c mpz_words.h uint32.h byte.h
	./compile mpz_words.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

predictable: \
load predictable.o
	./load predictable 

predictable.o: \
compile predictable.c uint32.h
	./compile predictable.c

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

prove: \
load prove.o mpz_bytes.o alloc.a error.a str.a gmp.lib
	./load prove mpz_bytes.o alloc.a error.a str.a  `cat \
	gmp.lib`

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

publickey: \
load publickey.o gmp.lib
	./load publickey  `cat gmp.lib`

publickey.o: \
compile publickey.c
	./compile publickey.c

reduce.o: \
reduce.s
	as -o reduce.o reduce.s

reduce.s: \
systype reduce.s.bsd reduce.s.linux
	(case "`cat systype`" in \
	  linux*) \
	    cat reduce.s.linux \
	    ;; \
	  *) \
	    cat reduce.s.bsd \
	    ;; \
	esac) > reduce.s

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

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

secretjudge: \
load secretjudge.o prime.o stralloc.a alloc.a error.a str.a gmp.lib
	./load secretjudge prime.o stralloc.a alloc.a error.a \
	str.a  `cat gmp.lib`

secretjudge.o: \
compile secretjudge.c prime.h alloc.h
	./compile secretjudge.c

secretkey: \
load secretkey.o prime.o stralloc.a alloc.a error.a str.a gmp.lib
	./load secretkey prime.o stralloc.a alloc.a error.a str.a  \
	`cat gmp.lib`

secretkey.o: \
compile secretkey.c uint64.h prime.h alloc.h
	./compile secretkey.c

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

shar: \
FILES BLURB README TODO THANKS CHANGES FILES VERSION SYSDEPS INSTALL \
BIN MAN TESTKEY TESTPUBLIC TESTJUDGE TESTSIG Makefile secretkey.c \
publickey.c secretjudge.c sign.c verify.c prove.c match.c \
predictable.c mpz_bytes.h mpz_bytes.c mpz_words.h mpz_words.c prime.h \
prime.c reduce.h reduce.s.bsd reduce.s.linux conf-cc conf-ld \
find-systype.sh make-compile.sh make-load.sh make-makelib.sh trycpp.c \
warn-auto.sh gen_alloc.h gen_allocdefs.h stralloc.3 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 alloc.3 alloc.h alloc.c alloc_re.c byte.h byte_chr.c \
byte_copy.c byte_cr.c byte_diff.c byte_rchr.c byte_zero.c str.h \
str_len.c error.3 error_str.3 error.h error.c error_str.c conf-bin \
conf-man install.c instcheck.c uint32.h1 uint32.h2 tryulong32.c \
snefru512.3 snefru512.h snefru512.c snefrufile.3 snefrufile.h \
snefrufile.c snefrusboxes.c endian.h1 endian.h2 trybigend.c \
substdio.h substdio.c substdi.c substdo.c subfd.h subfderr.c \
substdio_copy.c readwrite.h exit.h getln.3 getln.h getln.c getln2.3 \
getln2.c open.h open_read.c open_trunc.c strerr.h strerr_sys.c \
strerr_die.c scan.h scan_ulong.c scan_8long.c uint64.h1 uint64.h2 \
tryulong64.c
	shar -m `cat FILES` > shar
	chmod 400 shar

sign: \
load sign.o snefru.a error.a gmp.lib
	./load sign snefru.a error.a  `cat gmp.lib`

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

snefru.a: \
makelib snefru512.o snefrufile.o
	./makelib snefru.a snefru512.o snefrufile.o

snefru512.o: \
compile snefru512.c snefru512.h uint32.h snefrusr.c
	./compile snefru512.c

snefrufile.o: \
compile snefrufile.c snefru512.h uint32.h snefrufile.h
	./compile snefrufile.c

snefrusboxes: \
load snefrusboxes.o
	./load snefrusboxes 

snefrusboxes.o: \
compile snefrusboxes.c uint32.h
	./compile snefrusboxes.c

snefrusr.c: \
snefrusboxes
	./snefrusboxes > snefrusr.c

str.a: \
makelib str_len.o byte_chr.o byte_rchr.o byte_diff.o byte_copy.o \
byte_cr.o byte_zero.o
	./makelib str.a str_len.o byte_chr.o byte_rchr.o \
	byte_diff.o byte_copy.o byte_cr.o byte_zero.o

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

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 substdio_copy.o
	./makelib substdio.a substdio.o substdi.o substdo.o \
	subfderr.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

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

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

verify: \
load verify.o reduce.o mpz_words.o alloc.a error.a str.a gmp.lib
	./load verify reduce.o mpz_words.o alloc.a error.a str.a  \
	`cat gmp.lib`

verify.o: \
compile verify.c alloc.h byte.h error.h uint32.h mpz_words.h reduce.h
	./compile verify.c
