# Makefile for zlib for compiling by Borland C++ 5.5

!ifndef _SUBMAKE

CC       = bcc32
LD       = bcc32

!ifdef DEBUG
CDEBUGFLAGS = -v -vi -y -6 -Od
!else
CDEBUGFLAGS = -O2 -6 -T -DNDEBUG
!endif

!ifdef DYNRTL
DYNRTLFLAGS = -WR
!endif

CFLAGS   = -D_BCPP -w-aus -w-ccc -a8 $(DYNRTLFLAGS) -WC -X -q $(CDEBUGFLAGS)
LDFLAGS  = $(DYNRTLDFLAGS) -WC

!endif

# This clashes:
#CFLAGS_L=$(CFLAGS) -D__inline__=inline
CFLAGS_L=$(CFLAGS)

O        = .obj

# variables
OBJ = blocksort$(O) huffman$(O) crctable$(O) randtable$(O) compress$(O) \
  decompress$(O) bzlib$(O)

all:  bzip2.lib

blocksort.obj: blocksort.c
	$(CC) -c $(CFLAGS_L) $*.c

huffman.obj: huffman.c
	$(CC) -c $(CFLAGS_L) $*.c

crctable.obj: crctable.c
	$(CC) -c $(CFLAGS_L) $*.c

randtable.obj: randtable.c
	$(CC) -c $(CFLAGS_L) $*.c

compress.obj: compress.c
	$(CC) -c $(CFLAGS_L) $*.c

decompress.obj: decompress.c
	$(CC) -c $(CFLAGS_L) $*.c

bzlib.obj: bzlib.c
	$(CC) -c $(CFLAGS_L) $*.c

bzip2.lib: $(OBJ)
	del $@
	tlib /E $@ @&&!
+$(**: = &^
+)
!

clean:
	del *.obj
	del *.exe
	del *.dll
	del *.lib
	del *.tds
