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

# This file is used with the UNIX `make' command to cross-compile the example
# programs from the ECG Database Programmer's Guide, for which the sources can
# be found in this directory.  Since these programs are intended for
# instruction rather than `production' use, this `makefile' does not include a
# procedure for installing them.  To compile the examples, just type `make -f
# Makefile-dos-gcc' (from within this directory); the executable files will be
# left in this directory.  Type `make clean' to remove them.

# 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

# 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 = psamples.c exgetvec.c exputvec.c exannstr.c example1.c example2.c \
 example3.c example4.c example5.c example6.c example7.c example8.c example9.c \
 example10.c refhr.c
XFILES = psamples.exe exgetvec.exe exputvec.exe exannstr.exe example1.exe \
 example2.exe example3.exe example4.exe example5.exe example6.exe \
 example7.exe example8.exe example9.exe exampl10.exe refhr.exe

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

# `make' or `make compile':  compile the examples
compile:	$(XFILES)

exampl10.exe:
	$(CC) $(CFLAGS) example10.c -o $@ $(LDFLAGS)

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

