# file: makefile.dos	G. Moody	2 November 1989
#			Last revised:	 16 June 1995
# MSDOS `make' description file template for DB applications
#
# Copyright(C) Massachusetts Institute of Technology 1995. All rights reserved.

# This file is a template for a `make' description file generated by `install',
# which generates `makefile' by concatenating `dbconfig' with this file (and
# stripping out comments).  To use this file without `install', define these
# variables as appropriate for your system:

#   BINDIR	The directory in which the applications will be installed.
#   CC		The name of the command-line C compiler.
#   CDFLAGS	Optional arguments to be supplied to CC to produce object files
#		 with debugging symbols.
#   COFLAGS	Optional arguments to be supplied to CC to produce optimized
#		 object files (or normal object files if no optimization is
#		 available).
#   DBDIR	The directory in which DB data files are to be installed. (More
#		 than one directory may be used for this purpose;  DBDIR names
#		 the primary writeable directory.  See the discussion of the
#		 DB path in the ECG Database Programmer's Guide for details.)
#   LDB		CC option to link with the standard DB library.
#   LDBL	CC option to link with the large model DB library.
#   ML		CC option to compile for the large memory model.
#   PSPDIR	The directory in which PostScript prolog files will be
#		 installed.
#   PSPDST	The same as PSPDIR, except that any `\' characters should be
#		 quoted (i.e., represented as `\\';  Borland (Turbo) `make'
#		 requires *four* `\' characters to pass one in a string).
#		 PSPDST should end with a quoted `\'.
#   Q		The string necessary to insert a `"' character into a macro
#		 definition.
#   XXFILES	Optional executables to be built;  these may include any of:
#		   sample.exe
#		   view.exe
#		   vsetup.exe
#		The program `sample' requires hardware and software from
#		Microstar Laboratories; see `sample.c' for details.  The
#		Microstar headers ioutil.h, clock.h, and c_lib.c should be
#		installed in INCDIR, and the Microstar large-model library
#		should be installed in LIBDIR.  Microstar supplies libraries
#		for use with Microsoft C and Turbo C;  copy the appropriate one
#		to LIBDIR and name it `cdapl.lib'.  Do this before attempting
#		to compile `sample'.
#
#		The programs `view' and `vsetup' are written to use the
#		Microsoft C graphics library (`graphics.lib').  Precompiled
#		versions of `view' and `vsetup' are provided in the `bin'
#		directory. 

# Commands needed to build and install the DB applications are given below for
# several versions of `make'.
#
# Borland (Turbo) `make':
#    make install
# Microsoft `make' (supplied with Microsoft C before version 6.0):
#    make makefile
# Microsoft `nmake' (supplied with Microsoft C 6.0 and later versions):
#    nmake install

# Most versions of `make' allow you to override the settings of make variables
# from the command line, so that it may not be necessary to edit this file to
# test the effects of small modifications to it.

# For optimized code, uncomment the next line.
CFLAGS = $(COFLAGS)
# Otherwise, if you modify the sources and need to debug them, uncomment the
# next line.
# CFLAGS = $(CDFLAGS)

# Except as noted at the end of this file, it should not be necessary to modify
# anything below this line.
# -----------------------------------------------------------------------------

XFILES = bxb.exe calibr8.exe dbcoll8.exe dbdesc.exe dbwhich.exe ecgeval.exe \
 epic.exe fir.exe ihr.exe mrgann.exe mxm.exe nst.exe plotstm.exe pschart.exe \
 psfd.exe rdann.exe rdsamp.exe rxr.exe sigamp.exe skewedit.exe snip.exe \
 sqrs.exe sqrs125.exe sumann.exe sumstats.exe tach.exe wrann.exe xform.exe \
 $(XXFILES)

# General rule for compiling C sources into executable files
.c.exe:
	$(CC) $(CFLAGS) $*.c $(LDB)

# Rules for compiling programs that require non-standard options
# (Only Borland C/C++ 4.0 is known to require the large model to compile bxb,
# epic, nst, pschart, psfd, rxr, sumstats, and xform.  If your compiler permits
# it, you may get slightly faster executables of these programs using the small
# model.)

bxb.exe:	bxb.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

calibr8.exe:	calibr8.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

epic.exe:	epic.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

nst.exe:	nst.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

plotstm.exe:	plotstm.c
	$(CC) $(CFLAGS) $*.c

pschart.exe:	pschart.c
	$(CC) $(CFLAGS) $(ML) -DPROLOG=$(Q)$(PSPDST)pschart.pro$(Q) $*.c $(LDBL)

psfd.exe:	psfd.c
	$(CC) $(CFLAGS) $(ML) -DPROLOG=$(Q)$(PSPDST)psfd.pro$(Q) $*.c $(LDBL)

rxr.exe:	rxr.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

sample.exe:	sample.c
	-$(CC) $(CFLAGS) $(ML) $*.c $(LSAMPLE)

sumstats.exe:	sumstats.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

view.exe:	view.c
	cl -Ox view.c -link db graphics

vsetup.exe:	vsetup.c
	cl -Ox vsetup.c -link graphics

xform.exe:	xform.c
	$(CC) $(CFLAGS) $(ML) $*.c $(LDBL)

$(BINDIR):
	-mkdir $(BINDIR)

$(PSPDIR):
	-mkdir $(PSPDIR)

install:	$(XFILES) $(BINDIR) $(PSPDIR)
	copy *.exe $(BINDIR)
	copy dossetdb.bat $(BINDIR)
	copy *.pro $(PSPDIR)

# If you are using Microsoft `make', you may wish to comment out the next
# three lines to avoid having `make' clean up automatically.
clean:
	del *.obj
	del *.exe
