# If you have your TP and TASM the same, don't change it
# if not, point to the right stuff...
#
TPDIR = c:\tp
TASM  = tasm
#
# swap next definitions of TPC if debugging wanted
#
#TPCD  = $(TPDIR)/tpc /t$(CFG);$(TPDIR)
TPC   = $(TPDIR)/tpc /t$(CFG);$(TPDIR)

# swap next definitions of DEL if you don't have 4dos
#
# DEL  = del
#
DEL   = del /q

CFG   = .\tpc.cfg

APPS = beeper.exe \
       filer.exe \
       funfunk.exe \
       keycode.exe

all: $(APPS) makefile

$(CFG): makefile
        echo /Uc:\tp;c:\tp\units;c:\tp\src >$(CFG)
        echo /Oc:\tp\src;c:\tp\units >>$(CFG)
	echo /$G+ >>$(CFG)
        echo /L >> $(CFG)

beeper.exe: $(CFG) beeper.pas tsr.tpu
	$(TPC) beeper

filer.exe: $(CFG) filer.pas tsr.tpu tsrutil.tpu
	$(TPC) filer

funfunk.exe: $(CFG) funfunk.pas tsr.tpu
	$(TPC) funfunk
	
keycode.exe: $(CFG) keycode.pas tsrutil.tpu
	$(TPC) keycode

tsr.tpu: tsr.pas tsr.obj tphex.tpu
        $(TPC) tsr.pas
	
tsr.obj: tsr.asm
        $(TASM) tsr.asm
	
tsr.asm: tsr.pas
        sed -n -e "s/^;//p" tsr.pas > tsr.asm
	
tsrutil.tpu: tsrutil.pas
	$(TPC) tsrutil.pas
	
tphex.tpu: tphex.pas
        $(TPC) tphex.pas

clean:
        $(DEL) *.exe *.tpu tsr.asm $(CFG)

veryclean:
        $(DEL) *.obj *.exe *.tpu tsr.asm $(CFG)
