#
# Makefile
#

TOPLEVEL=../../..
CRYPTOTOP=..
OBJDIRNAME = obj

include $(CRYPTOTOP)/common.mk

# Input and output files for this subdirectory
LIBSRC=	bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c bn_mod.c \
	bn_print.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
	bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_err.c bn_sqr.c bn_asm.c \
	bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
	bn_depr.c bn_const.c
LIB= $(LIBDIR)/libcrypto.a

#
# Where to put the output binaries from this build
#
OUTPUTDIR = $(LIBDIR)

# Search paths (none for this project)
VPATH =

.PHONY: dobuild all clean cleanobjs

all: dobuild $(LIB)

SOURCE_FILES = $(LIBSRC)

DEPENDS = $(patsubst %.c, $(OBJDIR)/%.d, $(SOURCE_FILES))

COBJS = $(patsubst %.c, $(OBJDIR)/%.o, $(SOURCE_FILES))

OBJS = $(COBJS)

# Include the various dependancy files.
ifneq ($(MAKECMDGOALS), clean)
 ifneq ($(MAKECMDGOALS), cleanobjs)
  -include $(DEPENDS)
 endif # cleanobjs
endif # clean

$(LIB):	$(OBJS)
	$(AR) r $(LIB) $(OBJS)
	$(RANLIB) $(LIB) || echo Never mind.

clean: cleanobjs
	rm -f lib tags core .pure .nfs* *.old *.bak

cleanobjs:
	rm -f $(OBJDIR)/*.*
