#
# Makefile to compile the CadMac Bitmap Graphics Terminal Emulator.
#
#
# -DDEBUG for debug output
# -Dbip for a bipterm emulator
# -Dtek for a tektronix emulator
# -DPHONY_EVENT to simulate events with tty input.
# -DFIX_HOLE_IN_XHAIR for tek4014 crosshair intersection to have no "hole"
#

MAIN_DIR =	../..
INCLUDE_DIR =	$(MAIN_DIR)/include
MACLIB_DIR =	$(MAIN_DIR)/maclib
MACLIB =	$(MACLIB_DIR)/libmac.a
INCLUDES =	-I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/mac
LIBS =		$(MACLIB)
#CFLAGS =	$(INCLUDES) $(GLOBFLAGS) -DDEBUG -DPHONY_EVENT -f
CFLAGS =	$(INCLUDES) $(GLOBFLAGS) -f

TOOL_DIR =	$(MAIN_DIR)/mytools/bin
DEPEND =	$(TOOL_DIR)/depend


LOCALH =	biptek.h jobctl.h
CFILES =	terminal.c jobctl.c
OBJS =		jobctl.o

BINS =		bipterm tekterm


all:		$(BINS)

bipterm:	bipterm.o $(OBJS) $(LIBS)
		$(CC) $(CFLAGS) -o $@ $@.o $(OBJS) $(LIBS)

bipterm.o:	terminal.c
		$(CC) $(CFLAGS) -Dbip -c $?
		mv terminal.o $@

tekterm:	tekterm.o $(OBJS) $(LIBS)
		$(CC) $(CFLAGS) -o $@ $@.o $(OBJS) $(LIBS)

tekterm.o:	terminal.c
		$(CC) $(CFLAGS) -Dtek -c $?
		mv terminal.o $@

jobctl.o:	jobctl.c


clean:
		-/bin/rm -f $(OBJS) bipterm tekterm

lint:		$(CFILES) $(LOCALH)
		-lint -a -Dbip $(CFLAGS) $(CFILES)
		-lint -a -Dtek $(CFLAGS) $(CFILES)

tags:		$(CFILES) $(LOCALH)
		ctags $(LOCALH) $(CFILES)

depend:
		$(DEPEND) -M Makefile -S $(INCLUDES) $(CFILES)

########################################################################
# CADMUS Release Engineering
########################################################################

RELENG_build:	all

RELENG_install:
		$(RELENGINSTALL) /usr/bin -m 555 -o root -g root -s -i \
			bipterm \
			tekterm

RELENG_clean:	clean

########################################################################
############ DO NOT PUT STUFF BELOW HERE -- IT WILL GO AWAY ############
############ DO NOT DELETE THIS LINE -- MAKE DEPEND USES IT ############

terminal.o:     terminal.c
terminal.o:     ../../include/mac/Mac.h
terminal.o:     ../../include/mac/global.h
terminal.o:     ../../include/mac/bool.h
terminal.o:     ../../include/mac/MemMgr.h
terminal.o:     ../../include/mac/QuickDraw.h
terminal.o:     ../../include/mac/FontMgr.h
terminal.o:     ../../include/mac/LayerMgr.h
terminal.o:     ../../include/mac/WindowMgr.h
terminal.o:     ../../include/mac/ControlMgr.h
terminal.o:     ../../include/mac/EventMgr.h
terminal.o:     ../../include/mac/MenuMgr.h
terminal.o:     ../../include/mac/UtilMgr.h
terminal.o:     ../../include/mac/TextEdit.h
terminal.o:     ../../include/mac/RMgr.h
terminal.o:     ./biptek.h
terminal.o:     ./jobctl.h
terminal.o:     /usr/include/signal.h
terminal.o:     /usr/include/termio.h
terminal.o:     ../../include/sys/termio.h
terminal.o:     ../../include/sys/ioctl.h

jobctl.o:       jobctl.c
jobctl.o:       ./jobctl.h
jobctl.o:       /usr/include/signal.h
jobctl.o:       /usr/include/termio.h
jobctl.o:       ../../include/sys/termio.h
jobctl.o:       ../../include/sys/ioctl.h
