###############################################################
#
#  First, choose a C and C++ compilers, and set compiler flags.
#  This is done by setting the variables CXX, CC, CFLAGS, and
#  CXXFLAGS.
#
###############################################################


CC=gcc
# set this to your favorite C compiler


CXX=g++
# set this to your favorite C++ compiler


CFLAGS=
# set C compiler flags (e.g., -O2 -g)

CXXFLAGS=$(CFLAGS) 
# set C++ compiler flags 


###############################################################
#
#  Second, you need to specify where the NTL and nettle
#  include files and binaries may be found.
#
###############################################################


INCLUDE=-I/Users/shoup/u/sw/include
# set this to "-Idir" or "-Idir1 -Idir2" to tell the compiler
# where to look for include files

LIB=-L/Users/shoup/u/sw/lib
# set this to "-Ldir" or "-Ldir1 -Ldir2" to tell the compiler
# where to look for include files


###############################################################
#
#  Third, you *may* have to adjust some of these more
#  esoteric settings
#
###############################################################


AR=ar

ARFLAGS=ruv

RANLIB=ranlib


LDLIBS= $(LIB) -lnettle -lntl -lm

LDLIBS_CXX=$(LDLIBS)




###############################################################
#
#  That's it!  The rest of this makefile should not require
#  any adjustments.
#
###############################################################


# object files

OBJ = ostring.o group.o rsa_kem.o crypto.o hash.o kdf.o sc1.o sc2.o hmac.o dem1.o aes.o hc.o rem1.o rsaes.o

# library source files

SRC = ostring.C group.C rsa_kem.C crypto.C hash.C kdf.C sc1.C sc2.C hmac.C dem1.C aes.C hc.C rem1.C rsaes.C

INCL = ostring crypto.h kem.h hash.h kdf.h sc.h dem.h bc.h mac.h hc.h group.h rem.h rsaes.h ac.h



#################################################################
#
#  Rules for compiling the library
#
#################################################################



CRYPTO_INCLUDE = -Iinclude $(INCLUDE) 
# my crypto header files

COMPILE = $(CC) $(CRYPTO_INCLUDE)  $(CFLAGS) -c
COMPILE_CXX = $(CXX)  $(CRYPTO_INCLUDE)  $(CXXFLAGS) -c 

LINK = $(CC)  $(CRYPTO_INCLUDE)  $(CFLAGS) 
LINK_CXX = $(CXX) $(CRYPTO_INCLUDE)  $(CXXFLAGS) 



all:
	make crypto.a




crypto.a:	$(OBJ) 
	$(AR) $(ARFLAGS) crypto.a $(OBJ)
	- $(RANLIB) crypto.a

.c.o: 
	$(COMPILE) $<

.C.o: 
	$(COMPILE_CXX) $<

.C: 
	$(LINK_CXX) -o $@ $< crypto.a   $(LDLIBS_CXX) 


clean:
	- rm *.o 

