# file: makefile.dos	G. Moody	2 November 1989
#			Last revised:	12 October 1994		dblib 9.3
# MSDOS `make' description file template for compiling the DB library
#
# Copyright(C) Massachusetts Institute of Technology 1994. 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 (see below for suitable settings
# for several popular C/C++ compilers):

#   CC		The name of the command-line C compiler.
#   CDFLAGS	Optional arguments to be supplied to CC to produce object files
#		 with debugging symbols.
#   CDLLFLAGS	Optional arguments to be supplied to CC to produce object files
#		 for use in a Windows DLL.
#   COFLAGS	Optional arguments to be supplied to CC to produce optimized
#		 object files (or normal object files if no optimization is
#		 available).
#   DBLIB	The name of the standard (small memory model) DB library.
#   DBLLIB 	The name of the large memory model DB library.
#   DBDLL	The name of the large memory model DB dynamic link library
#		 (DLL) for use with MS Windows applications.
#   DBDLLDEF	The name of the DB DLL export definition file.  Two versions
#		 are provided (dbdll.def, for Microsoft C/C++, and tdbdll.def,
#		 for Borland or Turbo C/C++).  The only difference between them
#		 is in the first line, which specifies the base name of the
#		 export library (DB for Microsoft C/C++, TDB for Borland or
#		 Turbo C/C++).
#   DBILIB	The name of the import library corresponding to DBDLL.
#   INCDIR 	One of the directories searched by CC for #include <...>
#		 files.  For Microsoft C, use one of the directories specified
#		 by the INCLUDE environment variable.  If you are using Turbo
#		 or Borland C, it may be most convenient to use the directory
#		 in which the standard headers reside (e.g., \tc\include or
#		 \bc4\include).  The DB library *.h files will be installed in
#		 the `ecg' subdirectory of INCDIR.
#   LB		The name by which the program that constructs libraries from
#		 object files is invoked from the command line.
#   LBPUNCT	The punctuation that is appended to the list of object files
#		 given as a command-line argument to LB.
#   LIBDIR 	One of the directories searched by CC for *.lib files.  For
#		 Microsoft C, it should be one of the directories specified by
#		 the LIB environment variable;  for Turbo or Borland C, you may
#		 find it most convenient to use the directory in which the
#		 standard libraries reside (e.g., \tc\lib or \bc4\lib).
#		 The DB libraries will be installed in LIBDIR.
#   ML		CC option to compile for the large memory model.

INCDIR = c:\include
LIBDIR = c:\lib

# The value of CFILES is a list of sources used for all versions of the DB
# library.  The value of LBARG is a list of modules, which should match the
# source file names in CFILES, for use by the library-building utility.  These
# variables should not require modification;  they are defined here so that
# system-dependent variables below may incorporate their values.
CFILES = dbinit.c annot.c signal.c calib.c dbio.c
LBARG = +dbinit+annot+signal+calib+dbio

# The value of TARGETS specifies which versions of the DB library will be
# compiled.  TARGETS may include one or more of `small', `large', and `dll'.
# Successful compilation of the DLL version requires the MS Windows SDK or
# equivalent (supplied with MS C/C++ 7.0, MS Visual C++, Borland C/C++, Turbo
# C for Windows, and available separately for many other C compilers).
TARGETS = small large dll

# The next two sections illustrate settings suitable for use with several
# popular C/C++ compilers.  Note that the particular names chosen for the
# compiled DB library have no special significance to any of these compilers.
# If you use compilers from more than one supplier, however, the libraries
# generated by each should be kept distinct to avoid confusion.  Makefiles for
# the DB applications assume the use of this scheme for naming the libraries.

# If you are using Microsoft C, uncomment the next 15 lines.
# CC = cl
# CDFLAGS = -Od -Za -Zi -DMSDOS -DUSE_FREAD
# CDLLFLAGS = -ALw -Gsw -Os -W3 -D_WINDLL -DUSE_FREAD -DUSE_FWRITE
# COFLAGS = -Ox -Za -DMSDOS -DUSE_FREAD
# DBLIB = db.lib
# DBLLIB = dbl.lib
# DBDLL = db.dll
# DBDLLDEF = dbdll.def
# DBILIB = dbdll.lib
# LB = lib
# LBPUNCT = ,;
# LINKDLL = link libentry$(LBARG), $(DBDLL), db.map/map, ldllcew.lib \
#  libw.lib/noe/nod,$(DBDLLDEF)
# ML = -Ml
# Q = \"

# If you are using Borland C, uncomment the next 15 lines.
CC = bcc
CDFLAGS = -Od -A -w- /V -DMSDOS
CDLLFLAGS = -Os -w- -ml -WD -D_WINDLL -DUSE_FREAD -DUSE_FWRITE
COFLAGS = -Ox -A -w- -DMSDOS
DBLIB = tdb.lib
DBLLIB = tdbl.lib
DBDLL = tdb.dll
DBDLLDEF = tdbdll.def
DBILIB = tdbdll.lib
LB = tlib
LBPUNCT = 
LINKDLL = tlink /c/x/P-/Twd c0dl$(LBARG), $(DBDLL), , import mathwl cwl,\
 $(DBDLLDEF)
ML = -ml
Q = \"
# For Turbo C, uncomment the previous 14 lines and the next line.
# CC = tcc

# Commands needed to build and install the DB library 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.
# -----------------------------------------------------------------------------

$(LIBDIR):
	-mkdir $(LIBDIR)

# Build the small-model library
buildsmall:
	del $(DBLIB)
	$(CC) -c $(CFLAGS) $(CFILES)
	$(LB) $(DBLIB) $(LBARG)$(LBPUNCT)

# Install the small-model library
small:		buildsmall
	copy $(DBLIB) $(LIBDIR)

# Build the large-model library
buildlarge:
	del $(DBLLIB)
	$(CC) -c $(CFLAGS) $(ML) $(CFILES)
	$(LB) $(DBLLIB) $(LBARG)$(LBPUNCT)

# Install the large-model library
large:		buildlarge
	copy $(DBLLIB) $(LIBDIR)

# Build the Windows DLL version of the library, and the import library
builddll:	
	del $(DBDLL)
	$(CC) -c $(CDLLFLAGS) $(CFILES)
	$(LINKDLL)
	implib $(DBILIB) $(DBDLLDEF)
	rc $(DBDLL)

# Install the Windows DLL version of the library, and the import library
dll:		builddll
	copy $(DBDLL) $(LIBDIR)
	copy $(DBILIB) $(LIBDIR)

# Install the header files.  (The copies in this directory are used when
# compiling the DB library;  the installed copies are needed only when
# compiling DB applications that use the library.)
headers:
	-mkdir $(INCDIR)
	-mkdir $(INCDIR)\ecg
	copy db.h $(INCDIR)\ecg
	copy ecgcodes.h $(INCDIR)\ecg
	copy ecgmap.h $(INCDIR)\ecg

install:	$(LIBDIR) $(TARGETS) headers

# If you are using Microsoft `make' (not `nmake'), you may wish to comment out
# the next five lines to avoid having `make' clean up automatically.
clean:
	-del $(DBLIB)
	-del $(DBLLIB)
	-del $(DBDLL)
	-del $(DBILIB)
	-del *.obj
