#
# 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

APIDIR  = m:\apibuild\api\rtos32\api
HRNFPGA = m:\apibuild\api\rtos32\api\heron_fpga\lib
SL      = m:\slbuild\sl\src
INCLUDE = $(RTTARGET)\include;m:\apibuild\api;$(SL);$(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

heartconf: heartconf.rtb

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

heartconf.exe: ..\heartconf.cpp Init.c
   cl /MT /W3 /GX /Fm -D_RTOS32=1 -DCMDLINE=1 -DPC=1 -oheartconf.exe \
	  ..\heartconf.cpp \
	  ..\..\lib\rtos32\rtossl.lib \
	  $(HRNFPGA)\hrnfpga.lib \
	  $(APIDIR)\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
