# Borland MAKE Makefile for PDCurses library - Windows console BC++ 7.0+
#
# Usage: make -f [path\]Makefile.bcc [DEBUG=] [WIDE=] [UTF8=]
#        [INFOEX=N] [target]
#
# where target can be any of:
# [all|demos|pdcurses.lib|testcurs.exe...]

O = obj
E = .exe
RM = del

!ifndef PDCURSES_SRCDIR
PDCURSES_SRCDIR = ..
!endif

!include $(PDCURSES_SRCDIR)\version.mif
!include $(PDCURSES_SRCDIR)\libobjs.mif

osdir		= $(PDCURSES_SRCDIR)\vt

!ifdef OLD_BCC
CC		= bcc32 -q -DNO_STDINT_H
!else
CC		= bcc32c -q -Xdriver -Wno-deprecated-declarations
!endif

!ifdef DEBUG
CFLAGS		= -N -v -y -DPDCDEBUG
!else
CFLAGS		= -O -DCHTYPE_32
!endif

!ifdef CHTYPE_32
CFLAGS = $(CFLAGS) -DCHTYPE_32
!endif

!ifdef CHTYPE_16
CFLAGS = $(CFLAGS) -DCHTYPE_16
!endif

!ifdef WIDE
WIDEOPT		= -DPDC_WIDE
!endif

!ifdef UTF8
UTF8OPT		= -DPDC_FORCE_UTF8
!endif

!ifdef INFOEX
INFOPT          = -DHAVE_NO_INFOEX
!endif

!ifdef OLD_BCC
BUILD		= $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \
-w32 -w-par \
$(WIDEOPT) $(UTF8OPT) $(INFOPT)
!else
BUILD		= $(CC) -I$(PDCURSES_SRCDIR) -c -Tpe $(CFLAGS) \
$(WIDEOPT) $(UTF8OPT)
!endif

LIBEXE		= tlib /C /E /0 /a

LIBCURSES	= pdcurses.lib

all:	$(LIBCURSES)

clean:
	-$(RM) *.obj
	-$(RM) *.lib
	-$(RM) *.tds
	-$(RM) *.exe

demos:	$(DEMOS)

$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
	-$(RM) $@
	$(LIBEXE) $@ $(LIBOBJS) $(PDCOBJS)

.autodepend

{$(srcdir)\}.c.obj:
	$(BUILD) $<

{$(osdir)\}.c.obj:
	$(BUILD) $<

{$(demodir)\}.c.obj:
	$(BUILD) $<

.c.obj:
	$(BUILD) $<

.obj.exe:
	$(CC) -e$@ $** $(LIBCURSES)

tuidemo.exe:	tuidemo.obj tui.obj $(LIBCURSES)
	$(CC) -e$@ $**

tui.obj: $(demodir)\tui.c $(demodir)\tui.h $(PDCURSES_CURSES_H)
	$(BUILD) -I$(demodir) $(demodir)\tui.c

tuidemo.obj: $(demodir)\tuidemo.c $(PDCURSES_CURSES_H)
	$(BUILD) -I$(demodir) $(demodir)\tuidemo.c

PLATFORM1 = Borland C++ Wincon
PLATFORM2 = Borland C/C++ 7.2 for Windows console
ARCNAME = pdc$(VER)_bcc_vt

!include $(PDCURSES_SRCDIR)\makedist.mif
