# -I$(srcdir) is needed to pull in $(srcdir)/rsa-md4.h for ./t_mddriver.c.
CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/../des -I"$(srcdir)"

##DOSBUILDTOP = ..\..\..
##DOSLIBNAME=..\crypto.lib
##DOS!include $(BUILDTOP)\config\windows.in

.c.o:
	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
@SHARED_RULE@

OBJS=	md4.$(OBJEXT) md4glue.$(OBJEXT) md4crypto.$(OBJEXT)

SRCS=	$(srcdir)/md4.c $(srcdir)/md4glue.c $(srcdir)/md4crypto.c

all:: all-$(WHAT) $(OBJS)

all-unix:: shared
all-mac:: shared
all-windows::

shared:
	mkdir shared

t_mddriver.c: $(srcdir)/../md5/t_mddriver.c
	$(CP) $(srcdir)/../md5/t_mddriver.c t_mddriver.c

t_mddriver.o: t_mddriver.c
	$(CC) -DMD=4 $(CFLAGS) -c  t_mddriver.c

t_mddriver: t_mddriver.o md4.o
	$(CC) $(CFLAGS) -o t_mddriver t_mddriver.o md4.o

t_mddriver.exe:
	$(CP) $(srcdir)\..\md5\t_mddriver.c t_mddriver.c
	$(CC) -DMD=4 $(CFLAGS2) -o t_mddriver t_mddriver.c md4.c
	$(RM) md4.obj

t_cksum.c: $(srcdir)/../md5/t_cksum.c
	$(CP) $(srcdir)/../md5/t_cksum.c t_cksum.c

t_cksum.o: t_cksum.c
	$(CC) -DMD=4 $(CFLAGS) -c  t_cksum.c

t_cksum: t_cksum.o $(TOPLIBD)/libcrypto.a
	$(CC) $(CFLAGS) -o t_cksum t_cksum.o $(TOPLIBD)/libcrypto.a $(LIBS)

check-unix:: t_mddriver t_cksum
	$(C)t_mddriver -x
	$(C)t_cksum "this is a test"

check-windows:: t_mddriver$(EXEEXT)
	$(C)t_mddriver$(EXEEXT) -x

check:: check-$(WHAT)

clean:: clean-$(WHAT)
	$(RM) t_mddriver$(EXEEXT) t_mddriver.$(OBJEXT) t_mddriver.c
	$(RM) t_cksum$(EXEEXT) t_cksum.$(OBJEXT) t_cksum.c

clean-unix::
	$(RM) shared/*
clean-mac::
	$(RM) shared/*
clean-windows::
