#
# $Id: Makefile.in,v 1.19 1997/05/06 03:47:54 assar Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
AR = ar
RANLIB = @RANLIB@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
LIBS = @LIBS@
LIB_DBM = @LIB_DBM@

INSTALL = @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@

PICFLAGS = @PICFLAGS@
 
LIBNAME = $(LIBPREFIX)otp
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
LIBPREFIX = @LIBPREFIX@
LDSHARED = @LDSHARED@
EXECSUFFIX=@EXECSUFFIX@
LIB = $(LIBNAME).$(LIBEXT)
PROGS = otptest$(EXECSUFFIX)

LIB_SOURCES = otp.c otp_challenge.c otp_db.c otp_md.c \
	  otp_parse.c otp_print.c otp_verify.c

OTPTEST_SOURCES = otptest.c

SOURCES = $(LIB_SOURCES) $(OTPTEST_SOURCES)

LIB_OBJECTS = otp.o otp_challenge.o otp_db.o otp_md.o \
	  otp_parse.o otp_print.o otp_verify.o

OTPTEST_OBJECTS = otptest.o

OBJECTS = $(LIB_OBJECTS) $(OTPTEST_OBJECTS)
LIBROKEN=-L../../lib/roken -lroken

all: $(LIB) $(PROGS)

Wall:
	make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) -I$(srcdir)/../des $(CFLAGS) $(PICFLAGS) $<

install: all
	$(MKINSTALLDIRS) $(libdir)
	$(INSTALL_DATA) -m 0555 $(LIB) $(libdir)

uninstall:
	rm -f $(libdir)/$(LIB)

TAGS: $(SOURCES)
	etags $(SOURCES)

check:	otptest$(EXECSUFFIX)
	./otptest$(EXECSUFFIX)

clean:
	rm -f $(LIB) $(PROGS) *.o *.a

mostlyclean: clean

distclean: clean
	rm -f Makefile *~

realclean: distclean
	rm -f TAGS

otptest$(EXECSUFFIX): $(OTPTEST_OBJECTS) $(LIB)
	$(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ $(OTPTEST_OBJECTS) -L. -lotp -L../des -ldes $(LIBROKEN) $(LIB_DBM) $(LIBS) $(LIBROKEN)

$(LIBNAME).a: $(LIB_OBJECTS)
	rm -f $@
	$(AR) cr $@ $(LIB_OBJECTS)
	-$(RANLIB) $@

$(LIBNAME).$(SHLIBEXT): $(LIB_OBJECTS)
	rm -f $@
	$(LDSHARED) -o $@ $(LIB_OBJECTS)

$(OBJECTS): ../../include/config.h

.PHONY: all install uninstall check clean mostlyclean distclean realclean
