#
# Copyright 1987 by the Massachusetts Institute of Technology.
#
# For copying and distribution information,
# please see the file <mit-cpyright.h>.
#
# Makefile for BSD DES library
#
# First define machine type, compiler, and object file suffix
# Could be for VAX or PC-DOS
#
# Some of these files are cross compiled on the vax for the pc8086,
# using the MIT LCS cross-compilation environment
# Others are always executed on the vax(host).
#
# A machine, e.g. Vax, pc8086, IBM experimental workstation, is 
# described in terms of defines for its word length
# (BITS32 or BITS16), byte ordering (LSBFIRST or MSBFIRST) and 
# operating system (BSDUNIX or CROSSMSDOS).
#
# Make sure these are properly defined for any new machine types.
# target machine for run-time code (may cross-compile),
# override as needed 
#

RELDIR=des
!INCLUDE ..\config\NTMakefile.$(SYS_NAME)
!INCLUDE ..\config\NTMakefile.version

INCFILEDIR = $(DESTDIR)\include

INCFILES =\
	$(INCFILEDIR)\des.h \
	$(INCFILEDIR)\des_conf.h \
	$(INCFILEDIR)\mit-cpyright.h \
	$(INCFILEDIR)\des_odd.h \
	$(INCFILEDIR)\crypt.h \
        $(INCFILEDIR)\des\stats.h

$(INCFILEDIR)\des_odd.h: odd.h
	$(COPY) odd.h $@

$(INCFILEDIR)\des\stats.h: stats.h
        $(COPY) stats.h $@

# Library component lists.

LIBOBJS = \
	$(OUT)\des.obj \
	$(OUT)\cbc_encrypt.obj \
	$(OUT)\pcbc_encrypt.obj \
	$(OUT)\cksum.obj \
	$(OUT)\new_rnd_key.obj \
	$(OUT)\key_sched.obj \
	$(OUT)\debug_decl.obj \
	$(OUT)\quad_cksum.obj \
	$(OUT)\key_parity.obj \
	$(OUT)\weak_key.obj \
	$(OUT)\read_pssword.obj \
	$(OUT)\strng_to_key.obj \
	$(OUT)\misc.obj \
	$(OUT)\util.obj \
	$(OUT)\crypt.obj

$(LIBOBJS): $$(@B).c
    $(C2OBJ) $**

LIBFILE = $(DESTDIR)\lib\afsdes.lib

$(LIBFILE): $(LIBOBJS)
	$(LIBARCH)

#####################
# Generator Files ###
#####################

GENERATED_FILES = \
    $(VERSFILE).c \
	key_perm.h \
	p_table.h \
	s_table.h \
	odd.h \
	p.c \
	s.c \
	fp.c \
	ip.c

# Make generated files.
MAKETARG = $** $@

key_perm.h: $(OUT)\make_keyperm.exe
	$(MAKETARG)

p_table.h: $(OUT)\make_p_table.exe
	$(MAKETARG)

s_table.h: $(OUT)\make_s_table.exe
	$(MAKETARG)

odd.h: $(OUT)\make_odd.exe
	$(MAKETARG)

p.c: $(OUT)\make_p.exe
	$(MAKETARG)

s.c: $(OUT)\make_s.exe
	$(MAKETARG)

fp.c: $(OUT)\make_fp.exe
	$(MAKETARG)

ip.c: $(OUT)\make_ip.exe
	$(MAKETARG)

# Make generators.
$(OUT)\main.obj: main.c
    $(C2OBJ) $**

$(OUT)\make_keyperm.exe: $(OUT)\make_keyperm.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_p_table.exe: $(OUT)\make_p_table.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_s_table.exe: $(OUT)\make_s_table.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_odd.exe: $(OUT)\make_odd.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_p.exe: $(OUT)\make_p.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_s.exe: $(OUT)\make_s.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_fp.exe: $(OUT)\make_fp.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

$(OUT)\make_ip.exe: $(OUT)\make_ip.obj $(OUT)\misc.obj $(OUT)\main.obj
	$(EXECONLINK)

GENOBJS = $(OUT)\make_keyperm.obj \
    $(OUT)\make_p_table.obj \
    $(OUT)\make_s_table.obj \
    $(OUT)\make_odd.obj \
    $(OUT)\make_p.obj \
    $(OUT)\make_s.obj \
    $(OUT)\make_fp.obj \
    $(OUT)\make_ip.obj
    
$(GENOBJS): $$(@B).c
    $(C2OBJ) $**

install: $(GENERATED_FILES) $(LIBFILE) $(INCFILES)

install9x: install

clean::
	$(DEL) $(LIBFILE) $(GENERATED_FILES)

mkdir:

