#
# Example makefile for Turbo Vision experiments
# This version: N.S. Terry 15 March 1994, for BorlandC 3.1
#
# Probably does not work for overlays
#
.autodepend

MODEL	= l

BORDRIVE= E:
BORDIR  = \borlandc
TVISION = $(BORDRIVE)$(BORDIR)\tvision
TVLIB   = $(TVISION)\lib
TVINC   = $(TVISION)\include
LIBDIR	= $(BORDRIVE)$(BORDIR)\lib

STARTUP	= c0$(MODEL)
LIBS	= emu math$(MODEL) c$(MODEL) $(TVLIB)\tv.lib

CFLAGS	= -H -m$(MODEL) -V -Vmv -Vb -n$: -c -v -I$(TVINC)
LFLAGS 	= /Td /v /c /s /L$(LIBDIR)

FILES	= tvguid16.obj gadgets.obj

#
# generalised rule for turning .cpp files into .obj files
#
.cpp.obj:
	bcc $(CFLAGS) $< > $*.err

#
# Final command that builds the application, recompiling and linking
#
gec.exe : $(FILES) makefile
	TLINK $(LFLAGS) @&&!
$(STARTUP) +
$(FILES)
$* ,, $(LIBS)
!


---Explanatation------------------------------------------------------
Notes on the makefile.

TO USE THIS MAKEFILE you must define BORDRIVE and BORDIR. Define the
FILES macro to reflect the .obj files in your application and specify the
name of the .EXE you want to build - currently it says gec.exe which
is what this makefile builds, from tvguide16.cpp and gadgets.cpp.

Anything that looks like this $(XXX) or $ is a macro and is processed like
a #define in C. Some of the macros are predefined by the make utility
e.g. $< but most are defined by the user eg MODEL. In this makefile
the macros are as follows, reading from top to bottom.

MODEL    specifies which memory model you want to use. Because this is
         building for Turbovision it must be l for large.
BORDRIVE specifies which drive the borland distribution code in on.
	 On my system its on E:
BORDIR   specifies the root directory of the borland distribution code.
         On my system its in the default BORLANDC directory
TVISION  specifes the location of the turbovision subdirectory tree
         root
TVLIB    specifies the location of the Turbo Vision library
TVINC    specifies the location of the Turbo Vision includes files
LIBDIR   specifies the location of the main borland libraries
STARTUP  specifies the correct C startup code to use for the selected
         memory model
LIBS     specifies all the libraries that may be required during linking
         selecting the correct library memory model as required.
CFLAGS   these are the flags passed to the compiler during compilation
LFLAGS   these are the flags passed to the linker during linking
FILES    specifies the names of the object modules that make up the .EXE

The generalised rule .cpp.obj is basically a make macro that tells it
how, given any .cpp file it should be processed to give a .obj file.

Finally the few lines at the bottom basically state:

If any of the source files or the include files they depend on or the
makefile have been changed since the .EXE file was last
made, recompile any source files that changed, or any source files that
depend on any include files that have changed, then link them together
with the correct startup code, the actual application object modules
and the necessary libraries to create a new instance of the .EXE
file.

Note the use of .autodepend at the start of the file. This basically
makes it the compiler and make utilities problem to figure which
include files a particular source file is dependent on.

Also note that any error output you would normally get on the screen
is put in a file with the same name as the source file but with the
.err extension. This is for use with brief, it can then use the
information in the .err file next time you go into the editor type ^N
and it will show you each error in turn.


If you have any questions please mail me.
Cheers,
Nick Terry


