# Makefile for libg++.a

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

# This file is part of libg++, the GNU C++ library.

# 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.

srcdir = .

# 
# declarations from here on should not normally need to be changed 
# in order to compile libg++.a
#

# library sources 

EH_FILES = except.o

STREAM_OBJS = File.o  ostream.o istream.o streambuf.o filebuf.o Filebuf.o \
 PlotFile.o  SFile.o

REGEX_OBJ=rx.o
BIT_OBJS = bitand.o bitany.o bitblt.o bitclear.o bitcopy.o bitcount.o\
 bitinvert.o bitlcomp.o bitset1.o bitxor.o
OBJS =  AllocRing.o Obstack.o builtin.o \
 $(REGEX_OBJ) Regx.o Strng.o Intdouble.o Integer.o Rational.o \
 Complx.o  Random.o BitSet.o BitString.o LogNorm.o SmplHist.o SmplStat.o \
 Normal.o NegExp.o Weibull.o Erlang.o DiscUnif.o \
 Uniform.o Poisson.o HypGeom.o Geom.o Binomial.o \
 RNG.o ACG.o MLCG.o  RndInt.o  \
 Fix.o Fix16.o Fix24.o CursesW.o GetOpt.o $(EH_FILES) \
 new.o chr.o error.o gcd.o hash.o \
 lg.o fmtq.o ioob.o pow.o sqrt.o str.o timer.o \
 math.o compare.o $(BIT_OBJS) \
 SLList.o DLList.o

DEPEND_SOURCES = $(srcdir)/*.cc

#### host, target, and site dependent Makefile fragments come in here.
##
CC = gcc
CXX = gcc
CFLAGS = -O -D__ST_MT_ERRNO__
CXXFLAGS = -O -D__ST_MT_ERRNO__
CINCLUDES = -I.
CXXINCLUDES = -I.

.c.o:
	$(CC) -c $(CFLAGS) $(CINCLUDES) $<
.cc.o:
	$(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $<

AR = ar
AR_FLAGS = rc


.PHONY: add-to-targetlib
# Invoked from other directories, overriding $(TARGETLIB).
TARGETLIB=libgpp.a
add-to-targetlib: $(OBJS)
	$(AR) $(AR_FLAGS) $(TARGETLIB) $(OBJS)

# This is invoked by the top-level libg++ Makefile, to:
# a) make sure $(OBJS) are up-to-date, and
# b) make a list of those files that should be added to libg++.a.
libgxx.list: $(OBJS)
	@echo "$(OBJS)" >libgxx.list

install:
	for FILE in `(cd ${srcdir}; echo *.h gen/*.ccP gen/*.hP)`; do \
		rm -f $(gxx_includedir)/$$FILE ; \
		$(INSTALL_DATA) ${srcdir}/$$FILE $(gxx_includedir)/$$FILE \
		  || exit 1; \
		chmod a-x,a+r $(gxx_includedir)/$$FILE ; \
	done

rx.o: ../../librx/rx.c
	$(CC) -c $(CFLAGS) $(CINCLUDES) ../../librx/rx.c
