# Makefile for DIS

# Assembler options. Note: Tasm32 (v5.0) doesn't work. It crashes.
ASM             = tasm          # I used tasm v4.10
ASMFLAGS        = /w2/ml/t
!if $d(NODEBUG)
ASMDFLAGS       =
!else
ASMDFLAGS       = /zi
!endif

# Linker options
LINK            = tlink
LINKFLAGS       = /3/s /t        # /t to make a com file
!if $d(NODEBUG)
LINKDFLAGS      =
!else
LINKDFLAGS      = /v    # Not if .com file
!endif

# Library options
LIB             = tlib
LIBFLAGS        =

# Name of different files I create
DISLIB16        = dislib16
DISLIB32        = dislib32
PROGNAME        = DIS

OBJS            = dis.obj misc.obj

LIBS            = $(DISLIB16)

# Rules how to build files
.asm.obj:
        $(ASM) $(ASMFLAGS)$(ASMDFLAGS)$(CLIBFLAGS) $<

# Create the program
$(PROGNAME).com: $(OBJS) $(DISLIB16).lib
        $(LINK) $(LINKFLAGS)$(LINKDFLAGS) $(OBJS),$(PROGNAME),,$(LIBS)

# Create the 16-bit disassembler library
$(DISLIB16).lib: __dislib.obj dislib.obj
        @if exist $(DISLIB16).lib del $(DISLIB16).lib
        $(LIB) $(LIBFLAGS) $(DISLIB16) +dislib +__dislib,$(DISLIB16)

# Create the 32-bit disassembler library
$(DISLIB32).lib: dislib32.obj __disl32.obj
        @if exist $(DISLIB32).lib del $(DISLIB32).lib
        $(LIB) $(LIBFLAGS) $(DISLIB32) +dislib32 +__disl32,$(DISLIB32)

clean:
        @if exist *.lst del *.lst
        @if exist *.obj del *.obj
        @if exist *.lib del *.lib
        @if exist *.res del *.res
        @if exist *.map del *.map
        @if exist *.exe del *.exe
        @if exist *.tr2 del *.tr2
        @if exist *.tr  del *.tr
        @if exist *.td2 del *.td2
        @if exist *.td  del *.td 

# End of makefile
