# Makefile for g++ library test files

# Copyright (C) 1988 Free Software Foundation
#   written by Doug Lea (dl@rocky.oswego.edu)

# This file is part of GNU CC.

# GNU CC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY.  No author or distributor
# accepts responsibility to anyone for the consequences of using it
# or for whether it serves any particular purpose or works at all,
# unless he says so in writing.  Refer to the GNU CC General Public
# License for full details.

# Everyone is granted permission to copy, modify and redistribute
# GNU CC, but only under the conditions described in the
# GNU CC General Public License.   A copy of this license is
# supposed to have been given to you along with GNU CC so you
# can know your rights and responsibilities.  It should be in a
# file named COPYING.  Among other things, the copyright notice
# and this notice must be preserved on all copies.


GXX = g++

# g++ compliation flags:
# the fchar-charconst flag is mandatory for some stream ops to work sensibly


# utilities: these flags tell test0 where ld++ and crt1+.o are
LIBDIR = /usr/gnu/lib
TFLAGS = -DLDXX=\"$(LIBDIR)/gcc-ld++\" -DCRT1X=\"$(LIBDIR)/crt1+.o\"

GFLAGS = -g -O -fchar-charconst -I../g++-include -I. -fstrength-reduce -fno-defer-pop
#GFLAGS = -g -O -fchar-charconst -I../g++-include -I. -fstrength-reduce -mgnu


# compilation notes:
# ONLY the following g++ warnings are expected to appear:
#
# 1. In twrapper.cc and tgcwrapper.cc, warnings about lazy prototyping
#    
# 2. Several warnings from genclass about classes with only .h, no .cc files
#

# 
# Some of the tests output CPU processing time information. These
# figures are interesting, but are not always reliable guides
# to relative efficiencies of classes in practice, since the
# test files sometimes intentionally put code through worst-case
# situations, call infrequently used functions, etc.
#

# test files
TSRCS =  tFile.cc tObstack.cc tString.cc \
 tInteger.cc twrapper.cc tgwrapper.cc tRational.cc \
 tComplex.cc tBitSet.cc tBitString.cc tRandom.cc tList.cc tPlex.cc tLList.cc \
 tVec.cc tStack.cc tQueue.cc tDeque.cc tPQ.cc tSet.cc tSet2.cc tBag.cc tBag2.cc \
 tMap.cc tFix.cc tFix16.cc tFix24.cc \
 test.hello.cc test.bye.cc test.bye2.cc test.shell.cc \
 tCurses.cc

# executables
TOUTS =  test0 tFile tObstack tString \
  tInteger twrapper tgwrapper tRational tComplex tBitSet tBitString \
  tRandom tList tPlex tLList tVec tStack tQueue tDeque tPQ tSet \
  tSet2 tBag tBag2 tMap tFix tFix16 tFix24 tCurses test.bye test.bye2 test.shell

# files for archived prototype classes
LOBJS = \
 int.List.o int.SLList.o int.DLList.o int.Vec.o int.AVec.o \
 int.Plex.o  int.FPlex.o  int.XPlex.o int.RPlex.o int.MPlex.o \
 int.Set.o int.Bag.o int.int.Map.o int.PQ.o \
 int.Stack.o int.Queue.o int.Deque.o \
 int.XPSet.o  int.OXPSet.o  int.SLSet.o  int.OSLSet.o  int.BSTSet.o \
 int.AVLSet.o  int.SplaySet.o  int.VHSet.o  int.VOHSet.o  int.CHSet.o \
 int.XPBag.o  int.OXPBag.o  int.SLBag.o  int.OSLBag.o  int.SplayBag.o \
 int.VHBag.o  int.CHBag.o \
 int.int.VHMap.o  int.int.CHMap.o  int.int.SplayMap.o  int.int.AVLMap.o \
 int.SplayPQ.o  int.PHPQ.o  int.XPPQ.o \
 int.VStack.o \
 int.VQueue.o

LHDRS = \
 int.defs.h \
 int.XPStack.h int.SLStack.h \
 int.XPQueue.h  int.SLQueue.h \
 int.XPDeque.h int.DLDeque.h

# all g++ files should have extension .cc
.SUFFIXES: .cc
.cc.o:
	$(GXX) $(GFLAGS) -c  $<

tests: $(TOUTS)


libtest.a: $(LHDRS) $(LOBJS)
	ar r libtest.a $(LOBJS)
	ranlib libtest.a

test0: test0.h  test.hello.o test.bye test.bye2 test.shell
	$(GXX) test.hello.o -o test0

test.hello.o: test0.h test.hello.cc
	$(GXX) -c $(GFLAGS) $(TFLAGS) test.hello.cc -o test.hello.o

test.bye: test0.h test.bye.cc
	$(GXX) -c $(GFLAGS) $(TFLAGS) test.bye.cc -o test.bye

test.bye2: test0.h test.bye2.cc
	$(GXX) -c $(GFLAGS) $(TFLAGS) test.bye2.cc -o test.bye2

test.shell: test0.h test.shell.cc
	$(GXX) -c $(GFLAGS) $(TFLAGS) test.shell.cc -o test.shell


tFile:  tFile.o
	$(GXX) tFile.o  -o tFile

tObstack:  tObstack.o
	$(GXX) tObstack.o  -o tObstack -lg++ -lm

tString:  tString.o
	$(GXX) tString.o  -o tString -lg++ -lm

tInteger:  tInteger.o
	$(GXX) tInteger.o  -o tInteger -lg++ -lm

twrapper:  twrapper.o
	$(GXX) twrapper.o  -o twrapper -lg++ -lm

tgwrapper:   tgwrapper.o
	$(GXX) tgwrapper.o  -o tgwrapper -lg++ -lm

tRational:  tRational.o
	$(GXX) tRational.o  -o tRational -lg++ -lm

tComplex:  tComplex.o
	$(GXX) tComplex.o  -o tComplex -lg++ -lm

tBitSet:  tBitSet.o
	$(GXX) tBitSet.o  -o tBitSet -lg++ -lm

tBitString:  tBitString.o
	$(GXX) tBitString.o  -o tBitString -lg++ -lm

tRandom:  tRandom.o
	$(GXX) tRandom.o  -o tRandom -lg++ -lm

tFix:  tFix.o
	$(GXX) tFix.o  -o tFix -lg++ -lm

tFix16:  tFix16.o
	$(GXX) tFix16.o  -o tFix16 -lg++ -lm

tFix24:  tFix24.o
	$(GXX) tFix24.o  -o tFix24 -lg++ -lm

tCurses:  tCurses.o
	$(GXX) tCurses.o  -o tCurses -lg++ -lcurses -ltermcap

tList:  libtest.a  tList.o
	$(GXX) tList.o -o tList -L. -ltest -lg++ -lm

tPlex:  libtest.a  tPlex.o
	$(GXX) tPlex.o -o tPlex -L. -ltest -lg++ -lm

tLList:  libtest.a tLList.o
	$(GXX) tLList.o -o tLList -L. -ltest -lg++ -lm

tVec: libtest.a tVec.o
	$(GXX) tVec.o -o tVec -L. -ltest -lg++ -lm

tStack: libtest.a tStack.o
	$(GXX) tStack.o -o tStack -L. -ltest -lg++ -lm

tQueue: libtest.a tQueue.o
	$(GXX) tQueue.o -o tQueue -L. -ltest -lg++ -lm

tDeque: libtest.a tDeque.o
	$(GXX) tDeque.o -o tDeque -L. -ltest -lg++ -lm

tPQ: libtest.a tPQ.o
	$(GXX) tPQ.o -o tPQ -L. -ltest -lg++ -lm

tSet: libtest.a tSet.o
	$(GXX) tSet.o -o tSet -L. -ltest -lg++ -lm

tSet2: libtest.a tSet2.o
	$(GXX) tSet2.o -o tSet2 -L. -ltest -lg++ -lm

tBag:  libtest.a tBag.o
	$(GXX) tBag.o -o tBag -L. -ltest -lg++ -lm

tBag2:  libtest.a tBag2.o
	$(GXX) tBag2.o -o tBag2 -L. -ltest -lg++ -lm

tMap:  libtest.a tMap.o
	$(GXX) tMap.o -o tMap -L. -ltest -lg++ -lm

int.defs.h:
	genclass int val defs
int.Set.cc :
	genclass int val Set
int.XPSet.cc :
	genclass int val XPSet
int.OXPSet.cc :
	genclass int val OXPSet
int.SLSet.cc :
	genclass int val SLSet
int.OSLSet.cc :
	genclass int val OSLSet
int.BSTSet.cc :
	genclass int val BSTSet
int.AVLSet.cc :
	genclass int val AVLSet
int.SplaySet.cc :
	genclass int val SplaySet
int.VHSet.cc :
	genclass int val VHSet
int.VOHSet.cc :
	genclass int val VOHSet
int.CHSet.cc : 
	genclass int val CHSet
int.Bag.cc : 
	genclass int val Bag
int.XPBag.cc :
	genclass int val XPBag
int.OXPBag.cc :
	genclass int val OXPBag
int.SLBag.cc :
	genclass int val SLBag
int.OSLBag.cc :
	genclass int val OSLBag
int.SplayBag.cc :
	genclass int val SplayBag
int.VHBag.cc :
	genclass int val VHBag
int.CHBag.cc :
	genclass int val CHBag
int.int.Map.cc :
	genclass -2 int val int val Map
int.int.VHMap.cc :
	genclass -2 int val int val VHMap
int.int.CHMap.cc :
	genclass -2 int val int val CHMap
int.int.SplayMap.cc :
	genclass -2 int val int val SplayMap
int.int.AVLMap.cc :
	genclass -2 int val int val AVLMap
int.PQ.cc:
	genclass int val PQ
int.PHPQ.cc:
	genclass int val PHPQ
int.SplayPQ.cc:
	genclass int val SplayPQ
int.XPPQ.cc:
	genclass int val XPPQ
int.Stack.cc:
	genclass int val Stack
int.Queue.cc:
	genclass int val Queue
int.Deque.cc:
	genclass int val Deque
int.SLStack.h:
	genclass int val SLStack
int.SLQueue.h:
	genclass int val SLQueue
int.DLDeque.h:
	genclass int val DLDeque
int.List.cc: 
	genclass int val List
int.Plex.cc: 
	genclass int val Plex
int.FPlex.cc: 
	genclass int val FPlex
int.XPlex.cc: 
	genclass int val XPlex
int.MPlex.cc: 
	genclass int val MPlex
int.RPlex.cc: 
	genclass int val RPlex
int.FPStack.h:
	genclass int val FPStack
int.XPStack.h:
	genclass int val XPStack
int.FPQueue.h:
	genclass int val FPQueue
int.XPQueue.h:
	genclass int val XPQueue
int.XPDeque.h:
	genclass int val XPDeque
int.SLList.cc: 
	genclass int val SLList
int.DLList.cc: 
	genclass int val DLList
int.Vec.cc:
	genclass int val Vec
int.AVec.cc:
	genclass int val AVec
int.VStack.cc:
	genclass int val VStack
int.VQueue.cc:
	genclass int val VQueue

clean:
	rm -f *.o core libtest.a $(TOUTS) plot.out ffile streamfile int.* C++.hack*

