# This is the makefile required to build the s-e-p
# (Secure Encrypted Partition) software
# Sources are a mixture of C and Asm and will generate
# the 6 encryption (TSR) daemons and a configurator program
# which is common to all the daemons

# I have used Watcom C ver 10 to build this but after
# I have experienced a wrong jump offset generated by
# the Watcom Assembler I have switched to Borland Turbo Assembler
#
# wasm was (in version 10) far behind tasm (no jumps
# support, no multiple push/pop and so on)
# Still the Watcom C compiler is one of the best
# dos 16/32 bits C compilers I've seen
# So you'll need Watcom's C compiler and Borland's Assembler
# and Make to build this

# The object file secure.obj should always be placed last in
# the object file list because by using the DOSSEG directive
# and an offset from the BSS segment in secure.obj,
# the TSR function keep in memory all static data too.

# Use "make -DSTRIP" to build the optimized version
# without any debug information
# Change the -3 compiler switch and the .386 directive from
# the assembler files if you need to build this application
# for an older processor.
# (only 80186 instructions are used in this code)

# Author Emil LAURENTIU
# Date: Sunday, 29 March 1998

# Change the lines bellow to suit your environment
CPATH=c:\watcom
CC = binb\wcc
LINK = bin\wlink
ASM = tasm
AFLAGS = /ml /m3 /w1 /l /zi
!ifdef STRIP
CFLAGS = -ms -3 -s -oailmnrs -wx
LFLAGS =
!else
CFLAGS = -ms -3 -s -d2 -wx
LFLAGS = DEBUG ALL
!endif
.autodepend

all:	sepc.exe sep-idea.com sep-des.com sep-seal.com \
	sep-tss.com sep-blow.com sep-arc4.com

.c.obj:
	$(CPATH)\$(CC) $(CFLAGS) $*.c

.asm.obj:
	$(ASM) $(AFLAGS) $*.asm

sepc.exe: sepc.obj getopt.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	SYSTEM DOS
	FILE sepc.obj,getopt.obj
	NAME sepc
%

sep-idea.com: start.obj idea.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,idea.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-idea
	OPTION MAP
	FORMAT dos com
%

sep-blow.com: start.obj blowfish.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,blowfish.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-blow
	OPTION MAP
	FORMAT dos com
%

sep-des.com: start.obj des.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,des.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-des
	OPTION MAP
	FORMAT dos com
%

sep-seal.com: start.obj seal.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,seal.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-seal
	OPTION MAP
	FORMAT dos com
%

sep-tss.com: start.obj tss.obj md5.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,tss.obj,md5.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-tss
	OPTION MAP
	FORMAT dos com
%

sep-arc4.com: start.obj arcfour.obj secure.obj
	$(CPATH)\$(LINK) $(LFLAGS) @&&%
	LIBPATH %WATCOM%\lib286
	LIBPATH %WATCOM%\lib286\dos
	FILE start.obj,arcfour.obj,secure.obj
	LIBRARY clibs.lib
	NAME sep-arc4
	OPTION MAP
	FORMAT dos com
%

clean:
	del *.bak
	del *.obj
	del *.map
	del *.sym
	del *.pss
	del *.err
	del *.lst

distclean: clean
	del *.exe
	del *.com

indent:
	indent *.c *.h

