SHELL	= /bin/sh
CC	= gcc
#CC	= g++
OPT	= -O -Wall
DEBUG	= -g
BIN	= ../../bin
PROGS	= $(BIN)/md5 $(BIN)/sha1 $(BIN)/hfind
CFLAGS	= $(DEFS) $(INCL) $(OPT) $(DEBUG) -I. -I../auxtools $(XFLAGS)

LIBOBJ  = md5c.o sha1c.o
LIB = ../../lib/libtsk.a

defs:
	@CC="$(CC)" sh ../makedefs $(MAKE)

all:    lib $(PROGS)

lib: $(LIBOBJ)
	$(AR) $(LIB) $?
	$(RANLIB) $(LIB)

$(BIN)/md5: md5.o md5c.o
	$(CC) $(CFLAGS) -o $@ md5.o md5c.o

$(BIN)/sha1: sha1.o sha1c.o 
	$(CC) $(CFLAGS) -o $@ sha1.o sha1c.o

$(BIN)/hfind: hfind.o nsrl_index.o tm_lookup.o md5sum_index.o hk_index.o
	$(CC) $(CFLAGS) -o $@ hfind.o nsrl_index.o tm_lookup.o md5sum_index.o hk_index.o

indent:
	indent *.c *.h

clean:
	rm -f $(PROGS) *.o core *.core *~

depend: $(MAKES)
	(sed '1,/^# do not edit/!d' Makefile; \
	set -e; for i in [a-z][a-z0-9]*.c; do \
	    $(CC) -E $(DEFS) $(INCL) $$i | sed -n -e '/^# *1 *"\([^"]*\)".*/{' \
	    -e 's//'`echo $$i|sed 's/c$$/o/'`': \1/' -e 'p' -e '}'; \
	done) | grep -v '[.][o][:][ ][/]' >$$$$ && mv $$$$ Makefile

# do not edit below this line - it is generated by 'make depend'
hfind.o: hfind.c
hfind.o: hfind.h
hk_index.o: hk_index.c
hk_index.o: hfind.h
md5.o: md5.c
md5.o: global.h
md5.o: hash.h
md5c.o: md5c.c
md5c.o: global.h
md5c.o: hash.h
md5sum_index.o: md5sum_index.c
md5sum_index.o: hfind.h
nsrl_index.o: nsrl_index.c
nsrl_index.o: hfind.h
sha1.o: sha1.c
sha1.o: hash.h
sha1.o: global.h
sha1c.o: sha1c.c
sha1c.o: hash.h
sha1c.o: global.h
tm_lookup.o: tm_lookup.c
tm_lookup.o: hfind.h
