#
# Makefile for running on test programs.
#

# Add list of Source Files here
SRC=sio_Reader_t.cpp

# Add name of library to link to.  Include absolute or relative path name
LIBRARY=..\io\io___Win\io.lib

#Add include path(s) for header files used in test prgms.
INC=..

#List of header files used with the library and included in the test prgms
LIB_HDRS=

# Define the type of programs the test programs are.
TYPE=Win32_Console_MFC

# List of possible tests
# Win32_Console_No_MFC  - Console prgm with _no_ MFC support
# Win32_Console_MFC     - Console prgm with MFC support - static libs
# Win32_Console_MFC_DLL - Console prgm with MFC support - shared libs
# Win32_Window_No_MFC   - GUI prgm with no MFC support.
# Win32_Window_MFC      - GUI prgm with MFC suport. - static libs
# Win32_Window_MFC_DLL  - GUI prgm with MFC suport. - shared libs



#
# End user defined section
#

# Error Checking

!IF "$(SRC)" == ""
!MESSAGE "Please put a list of the source files in the Makefile"
!ERROR "No Source files."
!ENDIF

!IF "$(LIBRARY)" == "" 
!MESSAGE "Please put the name of the library you wish the programs 
!MESSAGE "linked to in the Makefile"
!ERROR "No library was specified"
!ENDIF

#
# Pre set for Visual C++
#
CC=cl
LD=cl 
LDOPT=/link /nologo /machine:I386
CFLAG=/nologo /W3 /GX

!IFDEF DEBUG
Win32=/D"WIN32" /D"_DEBUG"
!ELSE
Win32=/D"WIN32" /D"NDEBUG"
!ENDIF


Console=/D"_CONSOLE" /D"_MBCS"
LinkConsole=/subsystem:console

Window=/D"_Window"
LinkWindow=/subsystem:windows

NO_MFC=/ML 
MFC=/MT
MFC_DLL=/MD /D "_AFXDLL"


.SUFFIXES:
.SUFFIXES:.obj .cpp

#
# end predefs.
#
!IF "$(TYPE)" == "Win32_Console_No_MFC"
!MESSAGE Using configuration for Console prgm with _no_ MFC support
CFLAGS=$(CFLAG) $(Win32) $(Console) $(NO_MFC)
LDOPTS=$(LDOPT) $(LinkConsole)

!ELSEIF "$(TYPE)" == "Win32_Console_MFC"
!MESSAGE Using configuration for Console prgm with MFC support - static libs
CFLAGS=$(CFLAG) $(Win32) $(Console) $(MFC)
LDOPTS=$(LDOPT) $(LinkConsole)

!ELSEIF "$(TYPE)" == "Win32_Console_MFC_DLL"
!MESSAGE Using configuration for Console prgm with MFC support - shared libs
CFLAGS=$(CFLAG) $(Win32) $(Console) $(MFC_DLL)
LDOPTS=$(LDOPT) $(LinkConsole)


!ELSEIF "$(TYPE)" == "Win32_Window_No_MFC"
!MESSAGE Using configuration for GUI prgm with no MFC support.
CFLAGS=$(CFLAG) $(Win32) $(Window) $(NO_MFC)
LDOPTS=$(LDOPT) $(LinkWindow)


!ELSEIF "$(TYPE)" == "Win32_Window_MFC"
!MESSAGE Using configuration for GUI prgm with MFC suport. - static libs
CFLAGS=$(CFLAG) $(Win32) $(Window) $(MFC)
LDOPTS=$(LDOPT) $(LinkWindow)

!ELSEIF "$(TYPE)" == "Win32_Window_MFC_DLL"
!MESSAGE   Using configuration for GUI prgm with MFC suport. - shared libs
CFLAGS=$(CFLAG) $(Win32) $(Window) $(MFC_DLL)
LDOPTS=$(LDOPT) $(LinkWindow)

!ELSE
!MESSAGE You didn't set the Type of program to use
!MESSAGE Using default configuration.
!MESSAGE      DEFAULT: Console prgm with MFC suport. - static libs
CFLAGS=$(CFLAG) $(Win32) $(Console) $(MFC)
LDOPTS=$(LDOPT) $(LinkConsole)

!ENDIF



#
# Begin Makefile Rules
#
OBJS=$(SRC:.cpp=.obj)
EXES=$(OBJS:.obj=.exe)

.SILENT:

all:
        @$(MAKE) /C /nologo $(OBJS) $(EXES) $(CMDLINE)
	@echo. 
	@echo Programs up to date.


$(OBJS) : $$(@B).cpp $(LIB_HDRS)
        $(CC) /I$(INC) $(CFLAGS) /c $*.cpp /Fo$@

$(EXES): $$(@B).obj $(LIBRARY)
        $(LD) $*.obj /Fe$@ $(LDOPTS) $(LIBRARY)
	
nmake:

rebuild:
	@echo.
	@echo To rebuild run: nmake clean
	@echo 	    then run: nmake

clean:
	deltree /y *.obj *.exe





