#  1010, Thu 19 Aug 93
#
#  Makefile for ACCT: Nevil's PC Accounting Meter
#
#  Copyright (C) 1993 by Nevil Brownlee,
#  Computer Centre, University of Auckland
#

TCD=\tc
DEBUG= D        # set to D for disable, E for enable
MODEL= S        # set to L for large, S for small

#
#
# auto configure section
#
#

!if '$(DEBUG)'=='E'
IDEBUG=-v
TEXTDEBUG=enabled
LNKP   = tlink /m
!elif '$(DEBUG)'=='D'
IDEBUG=-v-
TEXTDEBUG=disabled
LNKP   = tlink /m/s
#!else
#!error  DEBUG must be set to either E or D
!endif

!if '$(MODEL)'=='L'
CMODEL=-ml
ACTPLIB=..\lib\acctlg.lib
SNMPLIB=..\lib\snmplg.lib
TCPLIB=..\lib\wattcplg.lib
CLIB    = $(TCD)\lib\ch $(TCD)\lib\mathh $(TCD)\lib\emu
TEXTMODEL=large
!elif '$(MODEL)'=='S'
CMODEL=-ms
ACTLIB=..\lib\acctsm.lib
SNMPLIB=..\lib\snmpsm.lib
TCPLIB=..\lib\wattcpsm.lib
TEXTMODEL=small
!else
!error  MODEL must be set to either S or L
!endif

# Assembler flags
ASM=tasm

INCLUDE= include
SNMPINCL= ..\snmp\include
CFLAGS= $(CMODEL) -G -r $(IDEBUG) -DAU_MSDOS -Ic:\tc\include -I..\include -I$(SNMPINCL) -I$(INCLUDE)
#CFLAGS= $(CMODEL) -G -r- $(IDEBUG) -DAU_MSDOS -Ic:\tc\include -I..\include  -I$(SNMPINCL) -I$(INCLUDE)
CC= tcc -c $(CFLAGS)
#CC= tcc -S $(CFLAGS)
#  -S option generates .asm file (instead of .obj file)

MAP    = $*

#
#  list of executables
#

.c.act:
	del $*.act
	$(CC) $*.c
	tlib $(ACTLIB) -+$*
	rename $*.obj $*.act

.c.obj:
        $(CC) $*.c

.asm.obj:
	$(ASM) $*.asm;

INCLUDES= $(INCLUDE)\flowhash.h $(INCLUDE)\met_vars.h

ACTOBJS = flowhash.act met_vars.act  chart.act

all: meter.exe

meter.exe :   $(INCLUDES) meter_pc.obj $(ACTOBJS)
	$(LNKP) \tc\lib\c0s meter_pc,meter,$(MAP),$(ACTLIB) $(SNMPLIB) $(TCPLIB) $(CLIB) \tc\lib\cs

clean:
   del *.act
   del *.obj
   del $(ACTLIB)
   del *.exe
