#######  Makefile for multiple C/C++ source file program Compilation #####
#
#  Date: Jan. 15, 2004
#  Author: Ivo Dinov
#  Version 1.0
#  Purpose: For UCLA Stat 130D Class demonstration
#  Notes:  specific to Borland 5.5 c++ compiler, but small changes, primarily in the library 
#		locations (-I and -L) links will make it compile on OS X, Linux, UNIX, etc.
#		<TABS> are very important in this makefile, these need to be preserved ...
#
#	MSDOS> make -f makefile_demo -n
#	MSDOS> make -f makefile_demo clean
#	MSDOS> make -f makefile_demo all
#	MSDOS> make -f makefile_demo
#	MSDOS> make -f makefile_demo test

# Define where is your compiler
CPP = bcc32

########################   Definitions ###################

#	Include library locations on my system --> these are likely
#	to be slightly different on everyone else's machine
Myflags = -IC:\Borland\BCC55\Include \
	-I.

#	Libraries
MyLinkFlags = -LC:\Borland\BCC55\Lib
MyLibs = -lm


########################   Targets    #################################

all: main_driver.exe


# for multiple input source files
OBJ=main_driver.obj myDemoFilter.obj myDemoIO.obj initialization.obj 

main_driver.exe: $(OBJ) 
	$(CPP) $(MyLinkFlags) $(OBJ) $(MyLibs)

test: main_driver.exe


###########################  Implicit Rules #######################
.cpp.obj:
    $(CPP) $(Myflags) -c {$? }

.obj.exe:
    $(CPP) $(MyLinkFlags) $< $(MyLibs)

########################## Clean all exec files, objects, links. Before a clean re-build ######
clean:
   -@if exist *.obj del *.obj                 >nul
   -@if exist *.lib del *.lib                 >nul
   -@if exist rwstdmsg.res del rwstdmsg.res   >nul
   -@if exist *.exe del *.exe                 >nul
   -@if exist *.dll del *.dll                 >nul
   -@if exist *.tds del *.tds                 >nul
   -@if exist $(PCHROOT).* del $(PCHROOT).*   >nul
