#
# Makefile to build the RTTarget-32 demo "writes"
#

!ifndef RTTARGET
RTTARGET_Not_Defined:
   @echo .
   @echo You must define environment variable RTTARGET to compile this example.
   @echo Run batch file VARSVC.BAT in RTTarget-32's installation directory first.
!endif


# Define some environment variables so the compiler and linker
# find everything

INCLUDE = $(RTTARGET)\include;$(HEAPI_DIR);$(INCLUDE)
LIB     = $(RTTARGET)\libmsvc;$(LIB)


# Set linker options to ensure the correct libraries are linked
# and that a relocation table is generated

LNKOPT  = -link /nodefaultlib:kernel32.lib /include:_malloc /include:_EnterCriticalSection@4 /include:_RTFileSystemList /fixed:no


writes: writes.rtb

writes.rtb: writes.exe monitor.rtb writes.cfg demopc.cfg
   rtloc -DBOOT writes demopc.cfg writes.cfg

writes.exe: ..\main.c ..\cload.c init.c
   cl /MT /Fm /Zi -D_RTOS32=1 -owrites.exe \
      ..\main.c \
      ..\cload.c \
      init.c \
      $(HEAPI_DIR)\rtos32\rtosdrv.lib \
      rtk32.lib \
      drvrt32.lib \
      rtfiles.lib \
      rtfsrtt.lib \
      rtt32.lib \
      rttheap.lib \
      $(LNKOPT)

monitor.rtb: monitor.cfg demopc.cfg
   rtloc -DBOOT Monitor demopc.cfg Monitor.cfg

clean:
      del *.ilk *.map *.lib *.loc *.pdb *.tds *.exp *.obj *.exe
