# ----------------------------------------------------------------------------
#
# A license is hereby granted to reproduce this software source code and
# to create executable versions from this source code for personal,
# non-commercial use.  The copyright notice included with the software
# must be maintained in all copies produced.
#
# THIS PROGRAM IS PROVIDED "AS IS". THE AUTHOR PROVIDES NO WARRANTIES
# WHATSOEVER, EXPRESSED OR IMPLIED, INCLUDING WARRANTIES OF
# MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE.  THE
# AUTHOR DOES NOT WARRANT THAT USE OF THIS PROGRAM DOES NOT INFRINGE THE
# INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY IN ANY COUNTRY.
#
# Copyright (c) 1995, John Conover, All Rights Reserved.
#
# Comments and/or bug reports should be addressed to:
#
#     john@johncon.com (John Conover)
#
# ----------------------------------------------------------------------------
#
# Makefile, makefile for rel
#
# $Revision: 1.1 $
# $Date: 1995/12/23 23:08:20 $
# $Id: Makefile,v 1.1 1995/12/23 23:08:20 john Exp $
# $Log: Makefile,v $
# Revision 1.1	1995/12/23 23:08:20  john
# Added special GNU gcc option; added compile time option to control program behavior during file system exceptions.
# Changes to files: Makefile, searchpath.c, searchfile.c, message.c, version.c-specifically to control program behavior under certain file system exceptions; specifics for the GNU gcc compiler, and ANSI C cosmetic formalities.
#
# Revision 1.0	1995/04/22  05:16:24  john
# Initial revision
#
# The define, FSE_CONTINUE, controls the program behavior during the
# file system exceptions, error opening file, and error opening
# directory-if defined, the program will continue under these
# exceptions, and if not defined, the program will shutdown under these
# exceptions. For particulars, see the file CHANGES, section "Version
# 1.1," and searchpath.c.
#
CFLAGS = -DFSE_CONTINUE -O -c
# CFLAGS = -DFSE_CONTINUE -g -c
LFLAGS = -O
# LFLAGS = -g
#
# System V, BSD:
#
# CC = cc $(CFLAGS) $*.c
# LINK = cc $(LFLAGS) -o $(PROGRAM) $(OBJECTS)
# LINT = /usr/bin/lint -ux -DLINT $(SOURCES)
#
# GNU gcc:
#
CC = gcc $(CFLAGS) $*.c
LINK = gcc $(LFLAGS) -o $(PROGRAM) $(OBJECTS)
LINT = gcc -DLINT -fsyntax-only -pedantic -W -Wall -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wenum-clash -Winline -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wno-import -Wpointer-arith -Wshadow -Wstrict-prototypes -Wtraditional -Wwrite-strings $(SOURCES)

PROGRAM = rel

HEADERS = rel.h \
	  postfix.h \
	  lexicon.h \
	  searchfile.h \
	  relclose.h \
	  stack.h \
	  eval.h \
	  bmhsearch.h \
	  searchpath.h \
	  translit.h \
	  qsortlist.h \
	  uppercase.h \
	  memalloc.h \
	  message.h \
	  version.h

SOURCES = rel.c \
	  postfix.c \
	  lexicon.c \
	  searchfile.c \
	  relclose.c \
	  eval.c \
	  bmhsearch.c \
	  searchpath.c \
	  translit.c \
	  qsortlist.c \
	  uppercase.c \
	  memalloc.c \
	  message.c \
	  version.c

OBJECTS = rel.o \
	  postfix.o \
	  lexicon.o \
	  searchfile.o \
	  relclose.o \
	  eval.o \
	  bmhsearch.o \
	  searchpath.o \
	  translit.o \
	  qsortlist.o \
	  uppercase.o \
	  memalloc.o \
	  message.o \
	  version.o

.c.o:
	$(CC)

$(PROGRAM): $(OBJECTS)
	$(LINK)

$(OBJECTS): $(HEADERS)

lint:
	$(LINT)

# Various test cases for the modules in rel-forces top down compile for
# assurance that -g is used

testlexicon: lexicon.c lexicon.h uppercase.c uppercase.h memalloc.c memalloc.h message.c message.h
	cc -DTEST_LEXICON -g -o testlexicon lexicon.c uppercase.c memalloc.c message.c

testpostfix: postfix.c postfix.h lexicon.c lexicon.h message.c message.h
	cc -DTEST_POSTFIX -g -o testpostfix postfix.c lexicon.c message.c memalloc.c eval.c uppercase.c

teststack: stack.h
	cp stack.h teststack.c
	cc -DTEST_STACK -g -o teststack teststack.c
	rm -f teststack.c

testmessage: message.c message.h
	cc -DTEST_MESSAGE -g -o testmessage message.c

testsearchfile: searchfile.c searchfile.h uppercase.c uppercase.h translit.c translit.h memalloc.c memalloc.h bmhsearch.c bmhsearch.h postfix.c postfix.h eval.c eval.h lexicon.c lexicon.h message.c message.h
	cc -DTEST_SEARCHFILE -g -o testsearchfile searchfile.c uppercase.c translit.c memalloc.c bmhsearch.c postfix.c eval.c lexicon.c message.c

testversion: version.c version.h
	cc -DTEST_VERSION -g -o testversion version.c

testuppercase: uppercase.c uppercase.h memalloc.c memalloc.h message.c message.h
	cc -DTEST_UPPERCASE -g -o testuppercase uppercase.c memalloc.c message.c

testsearchpath: searchpath.c searchpath.h searchfile.c searchfile.h uppercase.c uppercase.h translit.c translit.h memalloc.c memalloc.h bmhsearch.c bmhsearch.h postfix.c postfix.h eval.c eval.h lexicon.c lexicon.h message.c message.h
	cc -DTEST_SEARCHPATH -g -o testsearchpath searchpath.c	searchfile.c uppercase.c translit.c memalloc.c bmhsearch.c postfix.c eval.c lexicon.c message.c

testtranslit: translit.c translit.h uppercase.c uppercase.h memalloc.c memalloc.h message.c message.h
	cc -DTEST_TRANSLIT -g -o testtranslit translit.c uppercase.c memalloc.c message.c

testmemalloc: memalloc.c memalloc.h message.c message.h
	cc -DTEST_MEMALLOC -g -o testmemalloc memalloc.c message.c

testqsortlist: qsortlist.c qsortlist.h
	cc -DTEST_QSORTLIST -g -o testqsortlist qsortlist.c

testbmhsearch: bmhsearch.c bmhsearch.h memalloc.c memalloc.h message.c message.h
	cc -DTEST_BMHSEARCH -g -o testbmhsearch bmhsearch.c memalloc.c message.c
