#
#  makefile for building GDB
#
#  $Id: Makefile,v 1.2 90/07/11 13:10:19 mbp Exp Locker: mbp $
#
#  "make" will build the library "libgdb.a"
#
#  "make install" will build and install it
#
#  Before running this makefile, make sure the macros
#  below are set the the appropriate pathnames.
#
#########################################################################
#
#  To compile a version for debugging, set "DEBUG_OPTION=-g -DDEBUG"
#
#########################################################################

######################################################################

# configuration section:

# copiler options:
OPTIONS=-O

# Dir in which to install libgdb.a:
LIBDIR=$(HOME)/lib/$(CPUTYPE)

# Dir in which to install manual pages:
MANPATH=$(HOME)/man

# Extension to use for manual pages:
MANEXT=3

# Complete pathname for manual page dir; comment this out to thwart man
# page installation:
MANDIR=$(MANPATH)/man$(MANEXT)

# Dir in which to install header file gdb.h (needed by application programs):
INCLDIR=$(HOME)/lib/gdb

# Dir in which to install sample programs:
SAMPLEDIR=$(HOME)/lib/gdb

# Copying command to use in installation process
CP=ln

# end configuration section

######################################################################

SHELL=/bin/sh

# MAKEFILE = name of this Makefile
MAKEFILE = Makefile

COMPILE=cc -c $(OPTIONS)

INSTALL=instl -cp '$(CP)'

EXAMPLES = gdb_example.c gdb_example.h
OBJS=gdb.o
SRCS=gdb.c

libgdb.a:	$(OBJS)
	ar rc libgdb.a $(OBJS)
	ranlib libgdb.a

gdb.o:
	$(COMPILE) -o gdb.o gdb.c

gdb.doc:	gdb.nr
	/bin/rm -f gdb.doc ;
	nroff gdb.nr > gdb.doc

gdbintro.$(MANEXT):	gdb.man
	$(CP) gdbintro.man gdbintro.$(MANEXT)

gdb.$(MANEXT):	gdb.man
	$(CP) gdb.man gdb.$(MANEXT)

install:	install_example install_lib install_header install_man
	@echo ''
	@echo gdb installation complete
	@echo ''

install_lib:	libgdb.a
	$(INSTALL) '$(LIBDIR)' libgdb.a
	@if test "$(LIBDIR)" != "" ; then				\
	  echo ranlib $(LIBDIR)/libgdb.a ;				\
	  ranlib $(LIBDIR)/libgdb.a ;					\
	fi

install_man:	gdb.$(MANEXT) gdbintro.$(MANEXT)
	$(INSTALL) '$(MANDIR)' gdb.$(MANEXT) gdbintro.$(MANEXT)

install_header:	gdb.h
	$(INSTALL) '$(INCLDIR)' gdb.h

install_example:	$(EXAMPLES)
	$(INSTALL) -mkdir '$(SAMPLEDIR)' $(EXAMPLES)

clean:
	/bin/rm -f *.o *~ *% #*# ;

veryclean:
	/bin/rm -f libgdb.a gdb.doc gdb.$(MANEXT) gdbintro.$(MANEXT) \
		*.o *~ *% #*#

distclean:	veryclean

depend:
	mkdep $(MAKEFILE) $(SRCS) gdb_example.c

########################################################################

# Do not change or alter the '# BEGIN DEPENDENCY LIST' line below;
# 'make depend' uses it.  Anything you put after this line will go
# away when you do 'make depend'.

# BEGIN DEPENDENCY LIST

gdb.c:
gdb.o: gdb.c
gdb.o: ./gdb.h
gdb_example.c:
gdb_example.o: gdb_example.c
gdb_example.o: ./gdb.h
gdb_example.o: ./gdb_example.h
