#  1700, Tue 15 Jun 94
#
#  Makefile for SNMP: a subset of CMU snmp for PC snmp agents
#
#  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
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
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
WTCPINCL = ..\include
CFLAGS= $(CMODEL) -G -r $(IDEBUG) -DAU_MSDOS -Ic:\tc\include -I$(WTCPINCL) -I$(INCLUDE)
#CFLAGS= $(CMODEL) -G -r- $(IDEBUG) -DAU_MSDOS -Ic:\tc\include -I$(WTCPINCL) -I$(INCLUDE)
CC= tcc -c $(CFLAGS)
#CC= tcc -S $(CFLAGS)
#  -S option generates .asm file (instead of .obj file)

MAP    = $*

#
#
#  list of executables
#
#

.c.snm:
	del $*.snm
        $(CC) $*.c
        tlib $(SNMPLIB) -+$*
	rename $*.obj $*.snm

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

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

SNMPINCLS = $(INCLUDE)\ausnmp.h $(INCLUDE)\asn1.h $(INCLUDE)\mib.h \
	$(INCLUDE)\snmp.h $(INCLUDE)\snmpimpl.h

SNMPOBJS = asn1.snm snmp.snm snmpagnt.snm snmpauth.snm \
	mib.snm parse.snm snmpapi.snm snmpclnt.snm

all: snmplib.lib

snmplib.lib: $(SNMPINCLS) $(SNMPOBJS)


clean:
   del *.snm
   del $(SNMPLIB)
