CFLAGS = $(CCOPTS) $(DEFS) -I$(srcdir)/crc32 -I$(srcdir)/des -I$(srcdir)/md4 -I$(srcdir)/md5

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

TST=if test -n "`cat DONE`" ; then

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

OBJS=	cryptoconf.$(OBJEXT) \
	des_crc.$(OBJEXT) \
	des_md5.$(OBJEXT) \
	raw_des.$(OBJEXT)

SRCS=	$(srcdir)/cryptoconf.c \
	$(srcdir)/des_crc.c \
	$(srcdir)/des_md5.c \
	$(srcdir)/raw_des.c 

LIB_SUBDIRS= des md4 md5 crc32 os .
LIBUPDATE= $(BUILDTOP)/util/libupdate
LIBDONE= ./des/DONE ./md4/DONE ./md5/DONE ./crc32/DONE ./os/DONE ./DONE

# No dependencies.  Record places to find this shared object if the target
# link editor and loader support it.
DEPLIBS=
SHLIB_LIBS=
SHLIB_LDFLAGS= $(LDFLAGS) @SHLIB_RPATH_DIRS@
SHLIB_LIBDIRS= @SHLIB_LIBDIRS@

all:: shared

shared: 
	mkdir shared

# FIXME, need to build the library too...
all-mac:: $(OBJS)

all-windows:: $(OBJS)

libcrypto.$(STEXT): $(LIBDONE)
	if test -f $@ ; then \
		for i in $(LIB_SUBDIRS) ; \
		do \
			$(LIBUPDATE) $@ $$i/DONE $$i ; \
		done ; \
	else \
		for i in $(LIB_SUBDIRS) ; \
		do \
			$(LIBUPDATE) --force $@ $$i/DONE $$i ; \
		done ; \
	fi
	$(RANLIB) $@
	touch libcrypto.stamp

libcrypto.lib:
	libdir crypto.lib

clean:: clean-$(WHAT)

clean-unix::
	$(RM) libcrypto.a libcrypto.stamp shared/*

clean-windows::
	$(RM) crypto.lib crypto.bak

check:: check-$(WHAT)

check-unix::

all-windows::
	cd crc32
	@echo Making in crypto\crc32
	-$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
	cd ..\des
	@echo Making in crypto\des
	-$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
	cd ..\md4
	@echo Making in crypto\md4
	-$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
	cd ..\os
	@echo Making in crypto\os
	-$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
	rem BUG WITH NMAKE
	cd ..\md5
	@echo Making in crypto\md5
	-$(MAKE) -$(MFLAGS) LIBCMD=$(LIBCMD)
	cd ..

clean-windows::
	cd crc32
	@echo Making clean in crypto\crc32
	-$(MAKE) -$(MFLAGS) clean
	cd ..\des
	@echo Making clean in crypto\des
	-$(MAKE) -$(MFLAGS) clean
	cd ..\md4
	@echo Making clean in crypto\md4
	-$(MAKE) -$(MFLAGS) clean
	cd ..\md5
	@echo Making clean in crypto\md5
	-$(MAKE) -$(MFLAGS) clean
	cd ..\os
	@echo Making clean in crypto\os
	-$(MAKE) -$(MFLAGS) clean
	cd ..
	@echo Making clean locally

check-windows::
	cd crc32
	@echo Making check in crypto\crc32
	-$(MAKE) -$(MFLAGS) check
	cd ..\des
	@echo Making check in crypto\des
	-$(MAKE) -$(MFLAGS) check
	cd ..\md4
	@echo Making check in crypto\md4
	-$(MAKE) -$(MFLAGS) check
	cd ..\md5
	@echo Making check in crypto\md5
	-$(MAKE) -$(MFLAGS) check
	cd ..\os
	@echo Making check in crypto\os
	-$(MAKE) -$(MFLAGS) check
	cd ..

