#
# cterm Turbo C makefile
# ($Header: makefile,v 1.5 89/03/15 16:48:42 pkern Exp $)
#
#CC=	tcc -ml -G
CC=	tcc -G

# SYS:	main system
#    TI = TI Professional
#    PC = IBM PC
SYS=	TI

#LIB=	/tc2/lib/graphics.lib
LIB=

# VID:	video adaptor type, valid only when SYS=PC
#    MDA = mono
#    HGC = Hercules
#    CGA = Color Graphics
#    EGA = Enhanced Graphics
#    ATI = ATI EGA Wonder
#   (BGI = Borland graphics (included explicitly))
VID=	MDA

# CFLAGS=	-Ddbg -DFINIT="cterm.ini"
CFLAGS=	-M -D$(SYS) -DMACHINE_H="$(SYS).h"
EXE=	cterm

# Source files:
# main.c - main() & misc. system-related routines
# cterm.c - term() (the main I/O loop), devset() (the I/O chooser)
# esc.c - vt100 and vt52 ESC code interpreter.
# gfx.c - home-brew graphics ESC code interpreter.
# gfx_m.c - some graphics routines borrowed from BellCore's MGR.
# misc.c - misc vt100/vt52 key-code strings and routines.
# printer.c - dummy printer-port routines
# zout.c - output to console via DOS (not BIOS nor direct video)

# keybrd.$(SYS) - keyboard map and keyboard bios routines
# ports.$(SYS) - serial port I/O routines
# screen.$(SYS) - screen handling (text and graphics)
# scr_gfx.h	- screen graphics code (for IBM PCs with TC 1.0)

# setup.c - vt100-style interactive setup control
# defs.c - load/save setups from/to init file
# text.c - capture/send raw text

# kermit.c - antique C-kermit (from usenet (mod.sources?))
# xmodem.c - antique C-xmodem (from usenet (net.sources?))

OBJ=	main.obj cterm.obj misc.obj esc.obj gfx.obj gfx_m.obj \
	keybrd.obj ports.obj screen.obj printer.obj \
	setup.obj defs.obj text.obj zout.obj \
	kermit.obj xmodem.obj

cterm: $(OBJ)
	$(CC) $(CFLAGS) -e$(EXE) *.obj $(LIB)

#
# new:	saves time by loading tcc just once
#
new: turboc.cfg screen.$(SYS)
	touch *.*
	$(CC) $(CFLAGS) -c *.c *.$(SYS)
	
all: new cterm

screen.obj:	screen.$(SYS)
	$(CC) $(CFLAGS) -c screen.$(SYS)
	
screen.PC:	scr_gfx.h
	
scr_gfx.h:	scr_gfx.$(VID)
	copy scr_gfx.$(VID) scr_gfx.h
	-del screen.obj
	
.$(SYS).obj:
	$(CC) $(CFLAGS) -c $<

.c.obj:
	$(CC) $(CFLAGS) -c $<

clean: turboc.cfg
	-del *.obj
	-del *.map
