#
# OSLab module 5: message management makefile
#
# Choice of compiler (1 - Engineering network or 2 - stand alone)

COMPILER=1

# COM - the compiler to use (bcc)
# DIR - the directory to use (either borlandc or campus bc45)

!if $(COMPILER) == 1
COM=bcc
DIR=g:\apps\bc45
!elif $(COMPILER) == 2
COM=bcc
DIR=\borlandc
!else
!error Unknown compiler
!endif

#
# Kernel extensions to handle message passing
#

obj: m5.exe

ipc.obj: ipc.c msgmgmt.h module5.h
    $(DIR)\$(COM) -mc -c ipc.c
    $(DIR)\tlib ..\oslab -+ipc.obj

msgmgmt.obj: msgmgmt.c msgmgmt.h msgmem.h module5.h
    $(DIR)\$(COM) -mc -c msgmgmt.c
    $(DIR)\tlib ..\oslab -+msgmgmt.obj

regproc.obj: regproc.c msgmgmt.h msgmem.h module5.h
    $(DIR)\$(COM) -mc -c regproc.c
    $(DIR)\tlib ..\oslab -+regproc.obj

hwdata.obj: hwdata.c msgmgmt.h msgmem.h module5.h
    $(DIR)\$(COM) -mc -c hwdata.c

#

mainline.obj: mainline.c msgmgmt.h msgmem.h module5.h
    $(DIR)\$(COM) -mc -c mainline.c

#
# Sample communicating processes
#

m5.exe: m5.obj msgmgmt.obj consumer.obj producer.obj mainline.obj hwdata.obj\
		ipc.obj regproc.obj
    $(DIR)\tlink $(DIR)\lib\c0c mainline hwdata producer consumer m5, m5, \
    m5, ..\oslab $(DIR)\lib\cc

#    $(DIR)\lib\emu $(DIR)\lib\maths $(DIR)\lib\cs

#
# Producer consumer problem using communicating processes
#

m5.obj: m5.c 
    $(DIR)\$(COM) -mc -c m5.c

consumer.obj: consumer.c
    $(DIR)\$(COM) -mc -c consumer.c

producer.obj: producer.c
    $(DIR)\$(COM) -mc -c producer.c
