#
# $Id: Makefile.in,v 1.2 2001/12/04 02:06:26 rjs3 Exp $
#

SHELL = /bin/sh

srcdir = @srcdir@
VPATH = @srcdir@

CC = @CC@
LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
LN_S = @LN_S@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
LD_FLAGS = @LD_FLAGS@
LDSHARED = @LDSHARED@

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

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
transform=@program_transform_name@
EXECSUFFIX=@EXECSUFFIX@

PICFLAGS = @PICFLAGS@
 
LIB_DEPS = @lib_deps_yes@ -lc
build_symlink_command   = @build_symlink_command@
install_symlink_command = @install_symlink_command@

PROGS = destest$(EXECSUFFIX) \
	mdtest$(EXECSUFFIX) \
	des$(EXECSUFFIX) \
	rpw$(EXECSUFFIX) \
	speed$(EXECSUFFIX)
PROGS2INSTALL = des$(EXECSUFFIX)
LIBNAME = $(LIBPREFIX)des
LIBEXT = @LIBEXT@
LIBPREFIX = @LIBPREFIX@
SHLIBEXT = @SHLIBEXT@
LIB = $(LIBNAME).$(LIBEXT)

# Generated with lorder *.o | tsort | xargs echo

LIBSRC = xcbc_enc.c sha.c rnd_keys.c read_pwd.c qud_cksm.c pcbc_enc.c \
	ofb_enc.c ofb64enc.c ofb64ede.c ncbc_enc.c md4.c key_par.c fcrypt.c \
	ede_enc.c ecb3_enc.c cfb_enc.c cfb64enc.c cfb64ede.c cbc3_enc.c \
	str2key.c set_key.c md5.c cbc_enc.c cbc_cksm.c ecb_enc.c des_enc.c

LIBOBJ = xcbc_enc.o sha.o rnd_keys.o read_pwd.o qud_cksm.o pcbc_enc.o \
	ofb_enc.o ofb64enc.o ofb64ede.o ncbc_enc.o md4.o key_par.o fcrypt.o \
	ede_enc.o ecb3_enc.o cfb_enc.o cfb64enc.o cfb64ede.o cbc3_enc.o \
	str2key.o set_key.o md5.o cbc_enc.o cbc_cksm.o ecb_enc.o des_enc.o

all: $(LIB) $(PROGS)

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

COM = $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(PICFLAGS)

.c.o:
	$(COM) $(CFLAGS) $<

# Compile this file without debug if using gcc
des_enc.o: des_enc.c
	@if test "$(CC)" = gcc; then\
	  echo "$(COM) -fomit-frame-pointer -O3 $(srcdir)/des_enc.c"; \
	  $(COM) -fomit-frame-pointer -O3 $(srcdir)/des_enc.c; \
	else \
	  echo "$(COM) $(CFLAGS) $(srcdir)/des_enc.c"; \
	  $(COM) $(CFLAGS) $(srcdir)/des_enc.c; \
	fi

install: all
	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
	$(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
	@install_symlink_command@
	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
	for x in $(PROGS2INSTALL); do \
	  $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
	done

uninstall:
	rm -f $(DESTDIR)$(libdir)/$(LIB)
	for x in $(PROGS2INSTALL); do \
	  rm -f $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
	done

TAGS: $(LIBSRC)
	etags $(LIBSRC)

check: destest$(EXECSUFFIX) mdtest$(EXECSUFFIX)
	./destest$(EXECSUFFIX)
	./mdtest$(EXECSUFFIX)

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

mostlyclean: clean

distclean: clean
	rm -f Makefile *.tab.c *~

realclean: distclean
	rm -f TAGS

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

$(LIBNAME).$(SHLIBEXT): $(LIBOBJ)
	rm -f $@
	$(LDSHARED) -o $@ $(LIBOBJ) $(LIB_DEPS)
	@build_symlink_command@

# To make psoriaris make happy we have to mention these files in some
# rule, so we might as well put them here.

mdtest.o: mdtest.c
des_opts.o: des_opts.c
destest.o: destest.c
des.o: des.c
rpw.o: rpw.c
speed.o: speed.c

mdtest$(EXECSUFFIX): mdtest.o $(LIB)
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ mdtest.o -L. -ldes

des_opts$(EXECSUFFIX): des_opts.o set_key.o
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ des_opts.o set_key.o

destest$(EXECSUFFIX): destest.o $(LIB)
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ destest.o -L. -ldes

des$(EXECSUFFIX): des.o $(LIB)
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ des.o -L. -ldes

rpw$(EXECSUFFIX): rpw.o $(LIB)
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ rpw.o -L. -ldes

speed$(EXECSUFFIX): speed.o $(LIB)
	$(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ speed.o -L. -ldes

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

.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
