#
# 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);$(HESL_DIR)\inc;$(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

mysl: mysl.rtb

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

mysl.exe: Init.c ..\mysl.cpp
   cl /MT /W3 /GX /Fm /Zi -D_RTOS32=1 -DCMDLINE=1 -DPC=1 -omysl.exe \
	..\mysl.cpp \
	$(HESL_DIR)\lib\rtos32\rtossl.lib \
	$(HEAPI_DIR)\hrn_fpga\lib\rtos32\hrnfpga.lib \
	$(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
