# 
# Makefile for Crypto Class Library
#
# Created by:	Derek Atkins <warlord@MIT.EDU>
#
# $Source: /u3/warlord/src/crypto-class/src/dtypes/RCS/Makefile.src,v $
# $Author: warlord $
#

BUILDTOP = ..
SRCTOP = $(BUILDTOP)
include $(SRCTOP)/Makefile.vars

VPATH = $(SRCTOP)/dtypes
INCLUDES = -I. -I$(SRCTOP)/lib -I$(RSAREFDIR) $(DTYPE_INCS) $(GNU_INCS) \
	$(INCS) $(DBG) $(RSAREFPROTO) $(DTYPE_DEFINES)

LIBSRCS = block.cc crypto.cc hash.cc pubkey.cc random.cc

LIBOBJS = block.o crypto.o hash.o pubkey.o random.o

.SUFFIXES: .cc .o

.cc.o:
	$(RM) $@
	$(CXX) -c $(INCLUDES) $(CXXFLAGS) $<

default: all

all: libcrypto-dtypes.a crypto.so validate

libcrypto-dtypes.a:	$(LIBOBJS)
	$(RM) $@
	$(AR) $@ $(LIBOBJS)
	$(RANLIB) $@

crypto.so:	$(LIBOBJS)
ifneq ($(findstring alpha_osf,$(SYS)),)
	/usr/bin/ld -set_version 0.2.30 -shared -no_archive -soname crypto.so -o crypto.so *.o $(LIBDIR)/*.o $(RSAREFLIB) -L/mas/garden/system/dtcore/install/shlib/alpha_osf3/0.2.30/dtcore -L/mas/garden/system/gnu/shlib/alpha_osf3 -L/usr/gnu/lib -L/usr/local/shlib -L/usr/local/lib -ldtype++ -ldsys++ -lsyslog -lutils -ldat -lregex -lgmp -lgdbm -lcom_err -lm -lcxx -lc -lmxr
endif

validate: validate.o
	$(CXX) -o $@ validate.o $(LIBS)	
	
clean:
	$(RM) *.o
	$(RM) libcrypto-dtypes.a

subdirs:
	

# Dependencies below!  Don't change these unless you know what
# you're doing, but please change these if the sources change!
block.o: block.hh block_cipher.hh
crypto.o: block.hh hash.hh pubkey.hh random.hh
hash.o: hash.hh
pubkey.o: pubkey.hh random.hh $(SRCTOP)/lib/rsa.h $(SRCTOP)/lib/bignum.h
pubkey.o: $(SRCTOP)/lib/rng.h
random.o: random.hh $(SRCTOP)/lib/md5.h $(SRCTOP)/lib/rng.h
validate.o: block_cipher.hh $(SRCTOP)/lib/des.h $(SRCTOP)/lib/files.h
validate.o: $(SRCTOP)/lib/hex.h
validate: $(LIBDIR)/libcrypto.a
