include ../cpuopt.mk
CC=g++ 
CFLAGS=-O6 $(CPUOPT)
OBJS=bmath.o linteger.o lexp.o lmath.o montyrep.o residue.o
INCLDIR=../
LIBDIR=../lib
LIBNAME=linte
EXECUTABLES=
HEADERS=bmath.asm bmath.hxx bmath.inl linteger.hxx linteger.inl \
	lexp.hxx lexp.phx lexp.tpl montyrep.hxx montyrep.inl \
	residue.hxx residue.inl lmath.hxx

lib$(LIBNAME).a:	$(OBJS)
	ar cr lib$(LIBNAME).a $(OBJS) ; ranlib lib$(LIBNAME).a

all:	lib$(LIBNAME).a $(EXECUTABLES)

bmath.o:	bmath.hxx bmath.asm bmath.cxx
	$(CC) $(CFLAGS) -c bmath.cxx -I$(INCLDIR)

linteger.o:	bmath.hxx bmath.asm linteger.hxx linteger.inl linteger.cxx
	$(CC) $(CFLAGS) -c linteger.cxx -I$(INCLDIR)

lexp.o:	lexp.phx lexp.cxx
	$(CC) $(CFLAGS) -c lexp.cxx -I$(INCLDIR)

lmath.o:	bmath.hxx bmath.asm linteger.hxx linteger.inl \
		montyrep.hxx montyrep.inl residue.hxx residue.inl \
		lmath.hxx  lmath.cxx lexp.hxx lexp.phx lexp.tpl 
	$(CC) $(CFLAGS) -c lmath.cxx -I$(INCLDIR)

montyrep.o:	bmath.hxx bmath.asm linteger.hxx linteger.inl\
		lmath.hxx  montyrep.hxx montyrep.inl montyrep.cxx 
	$(CC) $(CFLAGS) -c montyrep.cxx -I$(INCLDIR)

residue.o:	bmath.hxx bmath.asm linteger.hxx linteger.inl\
		residue.hxx residue.inl residue.cxx 
	$(CC) $(CFLAGS) -c residue.cxx -I$(INCLDIR)

install-lib:	lib$(LIBNAME).a
	cp lib$(LIBNAME).a $(LIBDIR)/lib$(LIBNAME).a
 

install-headers:
	for HFILE in $(HEADERS) ; \
	do  ( cp $$HFILE ../include/linteger/ ) ; \
	done

install:	install-lib install-headers

clean:
	rm -f *~ *.o core lib$(LIBNAME).a $(EXECUTABLES)

dist-clean:	clean 
