# Copyright (C) 3L Ltd., 1987-1992

#
# Cut-down Makefile for Tbug.b4 only, for Gnu make instead of PolyMake
#

.SUFFIXES: .c .h .bin .b4

BITS = \tc2v2\crtlt4.bin \tc2v2\taskharn.t4
SABITS = \tc2v2\sacrtlt4.bin \tc2v2\taskharn.t4
T8SABITS = \tc2v2\sacrtlt8.bin \tc2v2\taskharn.t8
T4SABITS = \tc2v2\sacrtlt4.bin \tc2v2\taskharn.t4
CC = t4c
CFLAGS = /PC5 /I.

.c.bin :
	$(CC) $(CFLAGS) $<

OBJECTS = main.bin decode.bin allocate.bin symbols.bin \
          loadfile.bin lists.bin breaks.bin server.bin  \
          mapman.bin fileman.bin typeman.bin load-dbg.bin config.bin \
          explorer.bin ex-tadir.bin ex-thdir.bin \
          ex-fregs.bin ex-iregs.bin ex-asm.bin \
          ex-vars.bin ex-files.bin ex-data.bin

# main: tbug.b4 tbug.pdm basefile.pdm

#
# Debugger configured image file
#

tbug.b4: tbug.cfg main.tsk sacrific.tsk
	config tbug.cfg tbug.b4

#
# Sacrificial low-memory task
#

sacrific.tsk: sacrific.fud
	linkt sacrific.fud,sacrific.tsk/c

sacrific.fud: sacrific.bin
	hfudge sacrific.bin sacrific.fud


#
# The debugger's main task
#

main.tsk: $(OBJECTS) winlib.bin pdmlib.bin $(BITS)
	@echo $^ >$*.in
	linkt @$*.in,$@

#
# The various modules of the debugger interdepend on a large number
# of header files.  All of these dependencies are shown below.
#
interp.t8:	interp.h thread.h fpuctx.h intctx.h tf.h

interp.t4:	interp.h thread.h fpuctx.h intctx.h tf.h

t800-fpu.t8:	tf.h interp.h fpuctx.h intctx.h

config.bin:	config.h conf-pdm.h tf.h

typeman.bin:	mapman.h type-pdm.h types.h dtypes.h

mapman.bin:	mapman.h

fileman.bin:	mapman.h fileman.h tf.h

decode.bin:	opcodes.h direct.h

load-dbg.bin:	dbgarea.h linecorr.h fileman.h dbgarea.h misc-pdm.h \
		vars.h tf.h types.h dtypes.h glob-pdm.h

symbols.bin:	tf.h vars.h

breaks.bin:	breaks.h tf.h thread.h fpuctx.h

explorer.bin:	tf.h thread.h fpuctx.h glob-pdm.h explorer.h

ex-thdir.bin:	explorer.h thread.h fpuctx.h misc-pdm.h tf.h vars.h

ex-tadir.bin:	explorer.h vars.h tf.h exta-pdm.h

ex-iregs.bin:	explorer.h thread.h fpuctx.h misc-pdm.h tf.h

ex-fregs.bin:	explorer.h thread.h fpuctx.h misc-pdm.h tf.h

ex-vars.bin:	explorer.h thread.h fpuctx.h glob-pdm.h tf.h vars.h \
		direct.h exva-pdm.h types.h dtypes.h prefs.h

ex-files.bin:	explorer.h thread.h fpuctx.h exfi-pdm.h tf.h vars.h \
		direct.h breaks.h linecorr.h fileman.h

ex-asm.bin:	tf.h direct.h breaks.h thread.h fpuctx.h vars.h \
		misc-pdm.h explorer.h glob-pdm.h

ex-data.bin:	tf.h thread.h fpuctx.h explorer.h misc-pdm.h

server.bin:	thread.h fpuctx.h srvconst.h serv-pdm.h

main.bin:	vars.h glob-pdm.h interp.h thread.h fpuctx.h \
		breaks.h direct.h tf.h main-pdm.h config.h \
		fileman.h linecorr.h prefs.h

loadfile.bin:	thread.h fpuctx.h misc-pdm.h vars.h glob-pdm.h

#
# Some modules of the debugger also depend on header files belonging
# to the window system.
#
explorer.bin:	events.h keys.h

ex-tadir.bin:	events.h keys.h

ex-iregs.bin:	events.h

ex-thdir.bin:	events.h keys.h

ex-fregs.bin:	events.h

ex-vars.bin:	events.h keys.h

ex-files.bin:	events.h keys.h

ex-data.bin:	events.h keys.h

ex-asm.bin:	events.h keys.h

main.bin:	events.h keys.h basefile.h

#
# Structure of the PDMLIB library
#
pdmlib.bin:	pdm1file.h

#
# Structure of the WINLIB library
#
WINLIBOBJS =	WS-Panel.bin WS-Menus.bin WS-Keybd.bin   \
		WS-Wind.bin  WS-Alloc.bin WS-Aband.bin \
		WS-List.bin  WS-Event.bin WS-CList.bin   \
		WS-Help.bin  WS-Dlg.bin   WS-FSel.bin    \
		WS-Alrt.bin  WS-Dump.bin  WS-PDMMo.bin  \
		DOSFind.bin  GetCWD.bin

winlib.bin: $(WINLIBOBJS)
	@echo $^ >$*.in
	linkt @$*.in,$@/l

DOSFind.bin: moredos.h
WS-Alrt.bin: basefile.h
WS-Dlg.bin: events.h keys.h basefile.h
WS-FSel.bin: basefile.h moredos.h
WS-Help.bin: events.h keys.h
WS-PDMMo.bin: events.h keys.h basefile.h
WS-Dump.bin: events.h keys.h panels.h basefile.h wtypes.h
WS-Panel.bin: panels.h wtypes.h basefile.h
WS-Menus.bin: panels.h wtypes.h keys.h events.h basefile.h
WS-Keybd.bin: events.h keys.h panels.h wtypes.h basefile.h
WS-Wind.bin: panels.h wtypes.h events.h keys.h basefile.h
WS-Event.bin: events.h keys.h
WS-CList.bin: basefile.h

basefile.pdm: basefile.h
