# file: Makefile.dos	G. Moody	2 November 1989
#			Last revised:	21 January 2000		wfdblib 10.1.1
# MSDOS `make' description file template for compiling the WFDB library
#
# _____________________________________________________________________________
# wfdb: a library for reading and writing annotated waveforms(time series data)
# Copyright (C) 2000 George B. Moody
#
# This library is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
# more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# You may contact the author by e-mail (george@mit.edu) or postal mail
# (MIT Room E25-505A, Cambridge, MA 02139 USA).  For updates to this software,
# please visit PhysioNet (http://www.physionet.org/).
# _____________________________________________________________________________
#
# This file is a template for a `make' description file generated by `install',
# which generates `makefile' by concatenating `wfdbconf' 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).
#   WFDBLIB	The name of the standard (small memory model) WFDB library.
#   WFDBLLIB 	The name of the large memory model WFDB library.
#   WFDBDLL	The name of the large memory model WFDB dynamic link library
#		 (DLL) for use with MS Windows applications.
#   WFDBDLLDEF	The name of the WFDB DLL export definition file.  Two versions
#		 are provided (wfdbdll.def, for Microsoft C/C++, and
#		 twfdbdll.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 (WFDB for Microsoft C/C++,
#		 TWFDB for Borland or Turbo C/C++).
#   WFDBILIB	The name of the import library corresponding to WFDBDLL.
#   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 WFDB 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 WFDB 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 WFDB
# 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 = wfdbinit.c annot.c signal.c calib.c wfdbio.c
LBARG = +wfdbinit+annot+signal+calib+wfdbio

# The value of TARGETS specifies which versions of the WFDB 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 WFDB 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 WFDB 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
# WFDBLIB = wfdb.lib
# WFDBLLIB = wfdbl.lib
# WFDBDLL = wfdb.dll
# WFDBDLLDEF = wfdbdll.def
# WFDBILIB = wfdbdll.lib
# LB = lib
# LBPUNCT = ,;
# LINKDLL = link libentry$(LBARG), $(WFDBDLL), wfdb.map/map, ldllcew.lib \
#  libw.lib/noe/nod,$(WFDBDLLDEF)
# 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
WFDBLIB = twfdb.lib
WFDBLLIB = twfdbl.lib
WFDBDLL = twfdb.dll
WFDBDLLDEF = twfdbdll.def
WFDBILIB = twfdbdll.lib
LB = tlib
LBPUNCT = 
LINKDLL = tlink /c/x/P-/Twd c0dl$(LBARG), $(WFDBDLL), , import mathwl cwl,\
 $(WFDBDLLDEF)
ML = -ml
Q = \"
# For Turbo C, uncomment the previous 14 lines and the next line.
# CC = tcc

# Commands needed to build and install the WFDB 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 $(WFDBLIB)
	$(CC) -c $(CFLAGS) $(CFILES)
	$(LB) $(WFDBLIB) $(LBARG)$(LBPUNCT)

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

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

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

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

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

# Install the header files.  (The copies in this directory are used when
# compiling the WFDB library;  the installed copies are needed only when
# compiling WFDB applications that use the library.)
headers:
	-mkdir $(INCDIR)
	-mkdir $(INCDIR)\ecg
	copy wfdb.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 $(WFDBLIB)
	-del $(WFDBLLIB)
	-del $(WFDBDLL)
	-del $(WFDBILIB)
	-del *.obj
