CC = tcc
#CC = bcc32

TIMER = ZEN_TIMER
TIMER = CTC

!if $(CC) == tcc

MDL = l
ASM = tasm
LINK = tlink
AFLAGS = /ml
LIBDIR = C:\TC\lib
CFLAGS = -m$(MDL)
CFLAGS2 = -m$(MDL)
LDFLAGS = /L$(LIBDIR)
C0 = $(LIBDIR)\c0$(MDL)
LIBS = c$(MDL).lib math$(MDL).lib fp87.lib

!else

LIBDIR = d:\bcc55\lib
ASM = tasm
AFLAGS = /ml /D_WIN32
CFLAGS = -D_WIN32
LINK = ilink32
LDFLAGS = /L$(LIBDIR)
C0 = c0d32
LIBS = cw32.lib import32.lib uuid.lib

!endif

OBJS =  hw.obj setpins.obj delays.obj console.obj filefunc.obj \
        config.obj buffuncs.obj timer.obj

.c.obj:
        $(CC) -c $(CFLAGS) $<

.asm.obj:
        $(ASM) $(AFLAGS) $<

goal:   all03.exe eep3.exe mpu4.exe mpu5.exe mpu6.exe pic16.exe pgm89.exe mpu7.exe

pic16.exe:      pic16.c timer.obj
        $(CC) $(CFLAGS2) pic16.c timer.obj

mpu4.exe:       mpu4.c all03.h all03.lib
        $(CC) $(CFLAGS2) mpu4.c all03.lib

mpu5.exe:       mpu5.c all03.h all03.lib
        $(CC) $(CFLAGS2) mpu5.c all03.lib

all03.exe:      all03.c all03.h all03.lib
        $(CC) $(CFLAGS2) all03.c all03.lib

eep3.exe:       eep3.c all03.h all03.lib
        $(CC) $(CFLAGS2) eep3.c all03.lib

pgm89.exe:      pgm89.c all03.h all03.lib
        $(CC) $(CFLAGS) pgm89.c all03.lib

mpu6.exe:       mpu6.c all03.h all03.lib
        $(CC) $(CFLAGS) mpu6.c all03.lib
        
mpu7.exe:       mpu7.c all03.h all03.lib
        $(CC) $(CFLAGS) mpu7.c all03.lib

all03.lib:      $(OBJS)
        -DEL all03.lib
        tlib all03 +hw +setpins +delays +timer +console +filefunc +config +buffuncs

hw.obj:                 hw.c all03.h
delays.obj:             delays.asm
console.obj:    console.c all03.h
setpins.obj:    setpins.c all03.h
filefunc.obj:   filefunc.c all03.h
config.obj:             config.c all03.h
buffuncs.obj:   buffuncs.c all03.h
timer.obj:              timer.c timer.h
        
