# file: Makefile-dos-gcc	G. Moody	 23 April 1997
#
# GCC-DOS 'make' description file for DB applications
#
# Copyright(C) Massachusetts Institute of Technology 1997. All rights reserved.

# This file is used with the UNIX `make' command to cross-compile MS-DOS
# binaries of the standard applications that come with the ECG DB software
# package.  Before using it for the first time, check that the site-specific
# variables below are appropriate for your system.  To build and install the
# applications, just type `make -f Makefile-dos-gcc' (from within this
# directory).

# Site-specific variables
# -----------------------

# CCDIR is the directory containing the cross-compiler and the binary
# file utilities for MSDOS.
CCDIR = /usr/lib/gcc-lib/i386-go32-msdos/2.7.2

# CC is the name of the cross-compiler.
CC = $(CCDIR)/gcc

# CCDEFS is the set of C compiler options needed to set preprocessor variables
# while compiling the DB Software Package.  You should include definitions of
# the major, minor, and release numbers, and of MSDOS, as shown below.  Other
# definitions are needed only for various versions of UNIX and should be
# omitted here.
CCDEFS = -DDB_MAJOR=$(MAJOR) -DDB_MINOR=$(MINOR) -DDB_RELEASE=$(RELEASE) -DMSDOS

# CFLAGS is the list of C compiler options used when compiling programs in the
# `app', `convert', and `example' directories.  Add the following options to
# CFAPP as appropriate (separating them by spaces if you use more than one):
#   -g		  to save symbols for debugging
#   -O		  to use the optimizer
#   -I$(INCDIR)   needed if INCDIR is not in the normal search path for
#		   `#include' files;  harmless otherwise
#   -L$(LIBDIR)   needed if LIBDIR is not in the normal library search path;
#		   harmless if LIBDIR is in the normal library search path
# As noted above, gcc-dos allows you to use both -g and -O if you wish.
CFLAGS = -O -I/usr/local/dos/include $(CCDEFS) -L/usr/local/dos/lib

# LDFLAGS is appended to the C compiler command line to specify loading the
# DB library.  Unless you have changed the value of DBLIB in the `Makefile'
# for the DB library, `-ldb' should be correct.
LDFLAGS = -ldb

# BINDIR specifies the directory in which the applications will be installed;
# it should be a directory in the PATH of those who will use the applications.
# You will need to have write permission in BINDIR.  Users of this software
# will need to have search (execute) permission in BINDIR.
BINDIR = /usr/local/dos/bin

# PSPDIR specifies the directory in which PostScript prolog files are kept.
# (You may use any directory for this purpose;  if you have other PostScript
# applications, you may wish to keep all of your prolog files in the same
# directory, often /usr/local/lib/ps).  You will need to have write permission
# in PSPDIR.  Users of this software will need to have search (execute)
# permission in PSPDIR.
PSPDIR = /usr/local/dos/lib/ps

# STRIP is the command used to compact the compiled binaries by removing their
# symbol tables.  The next line is commented out because $(CCDIR)/strip fails.
# STRIP = $(CCDIR)/strip
# To retain the symbol tables for debugging, comment out the previous line, and
# uncomment the next line.
STRIP = :

# It should not be necessary to modify anything below this line.
# -----------------------------------------------------------------------------

CFILES = bxb.c calibrate.c dbcollate.c dbdesc.c dbplot.c dbtool.c dbwhich.c \
 ecgeval.c epic.c fir.c ihr.c mfilt.c mrgann.c mxm.c nst.c plotstm.c \
 pschart.c psfd.c rdann.c rdsamp.c rxr.c sample.c sigamp.c skewedit.c snip.c \
 sortann.c sqrs.c sqrs125.c sumann.c sumstats.c tach.c view.c vsetup.c \
 wrann.c wrsamp.c xform.c
XFILES = bxb.exe calibr8.exe dbcoll8.exe dbdesc.exe dbwhich.exe ecgeval.exe \
 epic.exe fir.exe ihr.exe mfilt.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 \
 sortann.exe sqrs.exe sqrs125.exe sumann.exe sumstats.exe tach.exe wrann.exe \
 wrsamp.exe xform.exe
PSFILES = pschart.pro psfd.pro

# General rule for compiling C sources into executable files.
.SUFFIXES: .exe
.c.exe:
	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)

# `make' or `make install':  build and install applications, clean up
install:	all
	cp $(XFILES) $(BINDIR)
	cp $(PSFILES) $(PSPDIR)
	$(MAKE) clean

# `make all': build applications
all:	$(XFILES)
	$(STRIP) $(XFILES)

# `make clean':  remove intermediate and backup files
clean:
	rm -f $(XFILES) *.o *~

# Rules for compiling applications that require non-standard options

bxb.exe:	bxb.c
	$(CC) $(CFLAGS) bxb.c -o $@ $(LDFLAGS) -lm
calibr8.exe:	calibrate.c
	$(CC) $(CFLAGS) calibrate.c -o $@ $(LDFLAGS)
dbcoll8.exe:	dbcollate.c
	$(CC) $(CFLAGS) dbcollate.c -o $@ $(LDFLAGS)
mxm.exe:	mxm.c
	$(CC) $(CFLAGS) mxm.c -o $@ $(LDFLAGS) -lm
nst.exe:	nst.c
	$(CC) $(CFLAGS) nst.c -o $@ $(LDFLAGS) -lm
plotstm.exe:	plotstm.c
	$(CC) $(CFLAGS) plotstm.c -o $@
pschart.exe:	pschart.c
	$(CC) $(CFLAGS) -DPROLOG=\"$(PSPDIR)/pschart.pro\" pschart.c -o $@ \
          $(LDFLAGS)
psfd.exe:	psfd.c
	$(CC) $(CFLAGS) -DPROLOG=\"$(PSPDIR)/psfd.pro\" psfd.c -o $@ $(LDFLAGS)
sigamp.exe:	sigamp.c
	$(CC) $(CFLAGS) sigamp.c -o $@ $(LDFLAGS) -lm
