# Change this to point to the location of the lsf.h file
LSFINCDIR = ../../../lsf

# Change KRB5TOP to point to the root of your Kerberos 5 installation
KRB5TOP=/opt/krb5

KRB5INC = -I$(KRB5TOP)/include
KRB5LIB = -R$(KRB5TOP)/lib -L$(KRB5TOP)/lib
KRB5LIBS = -lkrb5 -lcom_err -lcrypto

CC = cc
CFLAGS = -g -DDEBUG
LDFLAGS = -g 
LIBS = -lsocket -lnsl

SOCC = cc
SOCC64 = cc -xarch=v9
SOCFLAGS = -g -DSVR4 -I$(LSFINCDIR) -KPIC
SOLDFLAGS = -g -G

build all: eauth stash_key libresexec.so libsbdexec.so

eauth: eauth.o
	$(CC) $(LDFLAGS) $(KRB5LIB) -o eauth eauth.o $(KRB5LIBS) $(LIBS)

stash_key: stash_key.o
	$(CC) $(LDFLAGS) $(KRB5LIB) -o stash_key stash_key.o $(KRB5LIBS) $(LIBS)

eauth.o: eauth.c
	$(CC) $(CFLAGS) $(KRB5INC) -c eauth.c 

stash_key.o: stash_key.c
	$(CC) $(CFLAGS) $(KRB5INC) -c stash_key.c 

libresexec.so: resexec.o
	$(SOCC) $(RESPLUGFLAGS) $(SOLDFLAGS) -o libresexec.so resexec.o

resexec.o: resexec.c
	$(SOCC) $(SOCFLAGS) -o resexec.o -c resexec.c

libresexec_64.so: resexec_64.o
	$(SOCC64) $(RESPLUGFLAGS) $(SOLDFLAGS) -o libresexec_64.so resexec_64.o

resexec_64.o: resexec.c
	$(SOCC64) $(SOCFLAGS) -o resexec_64.o -c resexec.c 

libsbdexec.so: sbdexec.o
	$(SOCC) $(SOLDFLAGS) -o libsbdexec.so sbdexec.o

sbdexec.o: sbdexec.c
	$(SOCC) $(SOCFLAGS) -c sbdexec.c

clean:
	rm -f eauth stash_key *.o *.so

