OBJDIRS     += crypto

CRYPTOSRC   := BasicCrypto.cc paillier.cc urandom.cc arc4.cc hgd.cc pbkdf2.cc \
	       ecjoin.cc ECJoin.cc search.cc skip32.cc ffx.cc online_ope.cc mont.cc \
	       prng.cc ope.cc SWPSearch.cc ASHE.cc

CRYPTOOBJ   := $(patsubst %.cc,$(OBJDIR)/crypto/%.o,$(CRYPTOSRC))

all:	$(OBJDIR)/libedbcrypto.a $(OBJDIR)/libedbcrypto.so

$(OBJDIR)/libedbcrypto.so: $(CRYPTOOBJ) $(OBJDIR)/libedbutil.so
	$(CXX) -fPIC -shared -o $@ $(CRYPTOOBJ) $(LDFLAGS) $(LDRPATH) \
	       -ledbutil -lcrypto -lntl

$(OBJDIR)/libedbcrypto.a: $(CRYPTOOBJ)
	$(AR) r $@ $(CRYPTOOBJ)

#all:	$(OBJDIR)/crypto/x

$(OBJDIR)/crypto/x: $(OBJDIR)/crypto/x.o $(OBJDIR)/libedbcrypto.so
	$(CXX) $< -o $@ $(LDFLAGS) $(LDRPATH) -ledbcrypto


install: install_crypto

.PHONY: install_crypto
install_crypto: $(OBJDIR)/libedbcrypto.so
	install -m 644 $(OBJDIR)/libedbcrypto.so /usr/lib
