# Makefile for lrslib including lrs and redund 
# 2000.6.14
#
# choose one of the first 4 and gmp if applicable - see README
#
# make all      normal version for 32bit machines with timing/signals handling
# make all64    for machines with 64bit integers, eg. DEC Alpha
# make ansi     ansi standard version for 32bit machines without signals handling
# make nosigs   ansi standard version for 32bit machines without timing/signals handling

# make demo     compile the demo programs (vanilla machine)

# make gmp      uses gmp arithmetic, set paths for include files *first*

# make clean    to clean all executables


#Select on of the following INCLUDE,LIB paths only needed for gmp version

#linux at mcgill with gmp version 3
#INCLUDEDIR = /usr/local/include
#LIBDIR     = /usr/local/lib

#linux at mcgill with gmp version 2
#INCLUDEDIR = /labs/cgm/gmp2/include
#LIBDIR     = /labs/cgm/gmp2/lib


#TRUE64 at mcgill gmp version 3
INCLUDEDIR = /labs/cgm/include
LIBDIR     = /labs/cgm/lib

#TRUE64 at mcgill gmp version 2
#INCLUDEDIR = /labs/cgm/gmp2/include
#LIBDIR     = /labs/cgm/gmp2/lib



all:	lrs.c lrslib.c lrslib.h lrsmp.c lrsmp.h lrslong.c lrslong.h redund.c buffer.c
	gcc -O3 -DTIMES -DSIGNALS -o lrs  lrs.c lrslib.c lrsmp.c
	gcc -O3 -DTIMES -DSIGNALS -o redund  redund.c lrslib.c lrsmp.c
	gcc -O3 -DTIMES -DSIGNALS -DLONG -o lrs1  lrs.c lrslib.c lrslong.c
	gcc -O3 -DTIMES -DSIGNALS -DLONG -o redund1  redund.c lrslib.c lrslong.c
	gcc -O3 -o buffer buffer.c

gmp:	lrs.c redund.c lrslib.h lrslib.c lrsgmp.h lrsgmp.c
	gcc -O3 -static -DTIMES -DSIGNALS  -DGMP -I${INCLUDEDIR} lrs.c lrslib.c lrsgmp.c -L${LIBDIR}  -lgmp -o glrs
	gcc -O3 -static -DTIMES -DSIGNALS -DGMP -I${INCLUDEDIR} redund.c lrslib.c lrsgmp.c -L${LIBDIR} -lgmp -o gredund
	gcc -O3 -o buffer buffer.c

all64:	lrs.c lrslib.c lrslib.h lrsmp.c lrsmp.h lrslong.c lrslong.h redund.c buffer.c
	gcc -DTIMES -DSIGNALS -DB64 -O3 -o lrs  lrs.c lrslib.c lrsmp.c
	gcc -DTIMES -DSIGNALS -DB64 -O3 -o redund  redund.c lrslib.c lrsmp.c
	gcc -DTIMES -DSIGNALS -DLONG -DB64 -O3 -o lrs1  lrs.c lrslib.c lrslong.c
	gcc -DTIMES -DSIGNALS -DLONG -DB64 -O3 -o redund1  redund.c lrslib.c lrslong.c
	gcc -O3 -o buffer buffer.c

ansi:	lrs.c lrslib.c lrslib.h lrsmp.c lrsmp.h lrslong.c lrslong.h redund.c buffer.c
	gcc -ansi -DTIMES   -O3 -o lrs  lrs.c lrslib.c lrsmp.c
	gcc -ansi -DTIMES   -O3 -o redund redund.c lrslib.c lrsmp.c
	gcc -ansi -DTIMES  -DLONG  -O3 -o lrs1  lrs.c lrslib.c lrslong.c
	gcc -ansi -DTIMES  -DLONG  -O3 -o redund1 redund.c lrslib.c lrslong.c
	gcc -O3 -o buffer buffer.c

nosigs:	lrs.c lrslib.c lrslib.h lrsmp.c lrsmp.h lrslong.c lrslong.h redund.c buffer.c
	gcc -ansi  -O3 -o lrs  lrs.c lrslib.c lrsmp.c
	gcc -ansi  -O3 -o redund redund.c lrslib.c lrsmp.c
	gcc -ansi  -O3 -DLONG -o lrs1  lrs.c lrslib.c lrslong.c
	gcc -ansi  -O3 -DLONG -o redund1 redund.c lrslib.c lrslong.c
	gcc -ansi -O3 -o buffer buffer.c

lrs:    lrs.c lrslib.c lrslong.c lrsmp.c
	gcc -Wall -ansi -O3 -o lrs  lrs.c lrslib.c lrsmp.c

demo:	lpdemo.c chdemo.c vedemo.c lrslib.c lrslong.c lrsmp.c
	gcc -Wall -ansi -O3 -o lpdemo lpdemo.c lrslib.c lrsmp.c
	gcc -Wall -ansi -O3 -o vedemo vedemo.c lrslib.c lrsmp.c
	gcc -Wall -ansi -O3 -o chdemo chdemo.c lrslib.c lrsmp.c

clean:
	rm -rf lrs lrs1 redund redund1 buffer glrs gredund
	rm -rf lramsey oramsey ramsey ramsey1 aramsey aramsey1
	rm -rf glramsey gramsey 
	rm -rf lpdemo vedemo chdemo

ramsey:	ramsey.c lrslib.c lrsmp.c lrslong.c lramsey.c
	gcc  -O3 -ansi  -o ramsey ramsey.c lrslib.c lrsmp.c
	gcc  -O3 -ansi  -o lramsey lramsey.c lrslib.c lrsmp.c
	gcc  -O3 -DLONG -o ramsey1 ramsey.c lrslib.c lrslong.c

# for dec alpha
ramsey64:	ramsey.c lrslib.c lrsmp.c lrslong.c lramsey.c
	gcc  -DB64 -DTIMES -O3 -o aramsey ramsey.c lrslib.c lrsmp.c
	gcc  -DB64 -DTIMES -O3 -DLONG -o aramsey1 ramsey.c lrslib.c lrslong.c
	gcc  -DB64 -DTIMES -O3  -o alramsey lramsey.c lrslib.c lrsmp.c

foo:	foo.c lrslib.h lrslib.c lrsmp.h lrsmp.c
	gcc -O3 -static -DTIMES -DSIGNALS  foo.c lrslib.c lrsmp.c -L${LIBDIR} -o foo

gfoo:	foo.c lrslib.h lrslib.c lrsgmp.h lrsgmp.c
	gcc -O3 -static -DTIMES -DSIGNALS  -DGMP -I${INCLUDEDIR} foo.c lrslib.c lrsgmp.c -L${LIBDIR}  -lgmp -o gfoo

