# Generated automatically from Makefile.in by configure.
# Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
# Free Software Foundation, Inc.

# This file is part of GDB.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

prefix=/usr/local
exec_prefix=${prefix}

host_alias=i386-unknown-freebsd2.1.0
target_alias=i386-unknown-freebsd2.1.0
program_transform_name=s,x,x,
bindir=$(exec_prefix)/bin
libdir=$(exec_prefix)/lib
tooldir=$(libdir)/$(target_alias)

datadir=$(prefix)/lib
mandir=$(prefix)/man
man1dir=$(mandir)/man1
man2dir=$(mandir)/man2
man3dir=$(mandir)/man3
man4dir=$(mandir)/man4
man5dir=$(mandir)/man5
man6dir=$(mandir)/man6
man7dir=$(mandir)/man7
man8dir=$(mandir)/man8
man9dir=$(mandir)/man9
infodir=$(prefix)/info
includedir=$(prefix)/include
docdir=$(datadir)/doc

SHELL=/bin/sh

INSTALL=/usr/bin/install -c
INSTALL_PROGRAM=${INSTALL}
INSTALL_DATA=${INSTALL} -m 644

AR=ar
AR_FLAGS=qsv
RANLIB=
AWK=gawk

# Flags that describe where you can find the termcap library.
# This can be overridden in the host Makefile fragment file.
TERMCAP=-ltermcap

# If you are compiling with GCC, make sure that either 1) You have the
# fixed include files where GCC can reach them, or 2) You use the
# -traditional flag.  Otherwise the ioctl calls in inflow.c
# will be incorrectly compiled.  The "fixincludes" script in the gcc
# distribution will fix your include files up.
CC=gcc

# Directory containing source files.
srcdir=.

YACC=bison -y

# where to find makeinfo, preferably one designed for texinfo-2
MAKEINFO=makeinfo

# Set this up with gcc if you have gnu ld and the loader will print out
# line numbers for undefined references.
#CC_LD=gcc -static
CC_LD=$(CC)

# Where is our "include" directory?  Typically $(srcdir)/../include.
# This is essentially the header file directory for the library
# routines in libiberty.
INCLUDE_DIR=$(srcdir)/../include
INCLUDE_CFLAGS=-I$(INCLUDE_DIR)

# Where is the "-liberty" library?  Typically in ../libiberty.
LIBIBERTY=../../binutl2/libiberty/libiberty.a

# Where is the MMALLOC library?  Typically in ../mmalloc.
# Note that mmalloc can still be used on systems without mmap().
# To use your system malloc, comment out the following defines.
# MMALLOC_DIR=../mmalloc
# MMALLOC_SRC=$(srcdir)/$(MMALLOC_DIR)
# MMALLOC=$(MMALLOC_DIR)/libmmalloc.a
# To use your system malloc, uncomment MMALLOC_DISABLE.
MMALLOC_DISABLE=-DNO_MMALLOC
# To use mmalloc but disable corruption checking, uncomment MMALLOC_CHECK
#MMALLOC_CHECK=-DNO_MMALLOC_CHECK
MMALLOC_CFLAGS=$(MMALLOC_CHECK) $(MMALLOC_DISABLE)

# Where is the BFD library?  Typically in ../bfd.
BFD_DIR=../../binutl2/bfd
BFD=$(BFD_DIR)/libbfd.a
BFD_SRC=$(srcdir)/$(BFD_DIR)
BFD_CFLAGS=-I$(BFD_DIR) -I$(BFD_SRC)

# Where is the READLINE library?  Typically in ../readline.
READLINE_DIR=../readline
READLINE=$(READLINE_DIR)/libreadline.a
READLINE_SRC=$(srcdir)/$(READLINE_DIR)
READLINE_CFLAGS=-I$(READLINE_SRC)

# Opcodes currently live in one of two places.  Either they are in the
# opcode library, typically ../opcodes, or they are in a header file
# in INCLUDE_DIR.
# Where is the "-lopcodes" library, with (some of) the opcode tables and
# disassemblers?
OPCODES=../opcodes/libopcodes.a
# Where are the other opcode tables which only have header file
# versions?
OP_INCLUDE=$(INCLUDE_DIR)/opcode
OPCODES_CFLAGS=-I$(OP_INCLUDE)

# The simulator is usually nonexistent; targets that include one
# should set this to list all the .o or .a files to be linked in.
SIM =


ENABLE_CFLAGS= 
ENABLE_CLIBS= 
ENABLE_OBS= 

# -I. for config files.
# -I$(srcdir) for gdb internal headers and possibly for gnu-regex.h also.
# -I$(srcdir)/config for more generic config files.

# It is also possible that you will need to add -I/usr/include/sys if
# your system doesn't have fcntl.h in /usr/include (which is where it
# should be according to Posix).
DEFS=-DHAVE_CONFIG_H
GDB_CFLAGS=-I. -I$(srcdir) -I$(srcdir)/config $(DEFS)

# M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS
# from the config directory.
GLOBAL_CFLAGS=$(MT_CFLAGS) $(MH_CFLAGS)
#PROFILE_CFLAGS=-pg

# CFLAGS is specifically reserved for setting from the command line
# when running make.  I.E.  "make CFLAGS=-Wmissing-prototypes".
CFLAGS=

# Need to pass this to testsuite for "make check".  Probably should be
# consistent with top-level Makefile.in and gdb/testsuite/Makefile.in
# so "make check" has the same result no matter where it is run.
CXXFLAGS=-O

# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
INTERNAL_CFLAGS=$(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
	$(GDB_CFLAGS) $(OPCODES_CFLAGS) $(READLINE_CFLAGS) \
	$(BFD_CFLAGS) $(MMALLOC_CFLAGS) $(INCLUDE_CFLAGS) $(ENABLE_CFLAGS)

# LDFLAGS is specifically reserved for setting from the command line
# when running make.

# Profiling options need to go here to work.
# I think it's perfectly reasonable for a user to set -pg in CFLAGS
# and have it work; that's why CFLAGS is here.
INTERNAL_LDFLAGS=$(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) $(LDFLAGS)

# We are using our own version of REGEX now to be consistent across
# machines.
REGEX=gnu-regex.o
REGEX1=gnu-regex.o

# If your system is missing alloca(), or, more likely, it's there but
# it doesn't work, then refer to libiberty.

# Libraries and corresponding dependencies for compiling gdb.
# {X,T}M_CLIBS, defined in *config files, have host- and target-dependent libs.
# TERMCAP comes after readline, since readline depends on it.
# If you have the Cygnus libraries installed,
# you can use 'CLIBS=$(INSTALLED_LIBS)' 'CDEPS='
CLIBS=$(SIM) $(BFD) $(READLINE) $(OPCODES) $(MMALLOC) \
	$(ENABLE_CLIBS) $(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) \
	$(LIBIBERTY)
CDEPS=$(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \
	$(OPCODES) $(MMALLOC) $(LIBIBERTY)

ADD_FILES=$(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)
ADD_DEPS=$(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES)

VERSION=4.16
DIST=gdb

RUNTEST=`if [ -f $${rootsrc}/../dejagnu/runtest ] ; then \
		echo $${rootsrc}/../dejagnu/runtest ; else echo runtest; \
	   fi`

RUNTESTFLAGS=

# This is ser-unix.o for any system which supports a v7/BSD/SYSV/POSIX
# interface to the serial port.  Hopefully if get ported to OS/2, VMS,
# etc., then there will be (as part of the C library or perhaps as
# part of libiberty) a POSIX interface.  But at least for now the
# host-dependent makefile fragment might need to use something else
# besides ser-unix.o
SER_HARDWIRE=ser-unix.o

# The `remote' debugging target is supported for most architectures,
# but not all (e.g. 960)
REMOTE_OBS=remote.o dcache.o remote-utils.o

# This is remote-sim.o if a simulator is to be linked in.
SIM_OBS =

ANNOTATE_OBS=annotate.o

# Host and target-dependent makefile fragments come in here.

# Host: Intel 386 running FreeBSD
XDEPFILES= 
# NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o core-aout.o i386b-nat.o
NATDEPFILES=infvsta.o
XM_FILE= config/i386/xm-i386bsd.h
NAT_FILE= config/i386/nm-fbsd.h

# Target: Intel 386 running FreeBSD
TDEPFILES= i386-tdep.o i387-tdep.o
TM_FILE= config/i386/tm-i386bsd.h
# End of host and target-dependent makefile fragments

FLAGS_TO_PASS=\
	"prefix=$(prefix)" \
	"exec_prefix=$(exec_prefix)" \
	"against=$(against)" \
	"AR=$(AR)" \
	"AR_FLAGS=$(AR_FLAGS)" \
	"CC=$(CC)" \
	"CFLAGS=$(CFLAGS)" \
	"CXX=$(CXX)" \
	"CXXFLAGS=$(CXXFLAGS)" \
	"RANLIB=$(RANLIB)" \
	"MAKEINFO=$(MAKEINFO)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"RUNTEST=$(RUNTEST)" \
	"RUNTESTFLAGS=$(RUNTESTFLAGS)"

# Flags that we pass when building the testsuite.

# empty for native, $(target_alias)/ for cross
target_subdir=

CC_FOR_TARGET=gcc
CXX=gcc
CXX_FOR_TARGET=gcc

# The use of $$(x_FOR_TARGET) reduces the command line length by not
# duplicating the lengthy definition.
TARGET_FLAGS_TO_PASS=\
	"prefix=$(prefix)" \
	"exec_prefix=$(exec_prefix)" \
	"against=$(against)" \
	'CC=$$(CC_FOR_TARGET)' \
	"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
	"CFLAGS=$(CFLAGS)" \
	'CXX=$$(CXX_FOR_TARGET)' \
	"CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
	"CXXFLAGS=$(CXXFLAGS)" \
	"INSTALL=$(INSTALL)" \
	"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
	"INSTALL_DATA=$(INSTALL_DATA)" \
	"MAKEINFO=$(MAKEINFO)" \
	"RUNTEST=$(RUNTEST)" \
	"RUNTESTFLAGS=$(RUNTESTFLAGS)"

# "system" headers.  Using these in dependencies is a rather personal
# choice. (-rich, summer 1993)
# (Why would we not want to depend on them?  If one of these changes in a 
# non-binary-compatible way, it is a real pain to remake the right stuff
# without these dependencies -kingdon, 13 Mar 1994)
getopt_h =	$(INCLUDE_DIR)/getopt.h
floatformat_h =	$(INCLUDE_DIR)/floatformat.h
bfd_h =		$(BFD_DIR)/bfd.h
wait_h =	$(INCLUDE_DIR)/wait.h
dis-asm_h =	$(INCLUDE_DIR)/dis-asm.h 

dcache_h=dcache.h
remote_utils_h=$(dcache_h) serial.h target.h remote-utils.h remote-sim.h

gdbcore_h =	gdbcore.h $(bfd_h)

frame_h =	frame.h
symtab_h =	symtab.h bcache.h
gdbtypes_h =	gdbtypes.h
expression_h =	expression.h
value_h =	value.h $(symtab_h) $(gdbtypes_h) $(expression_h)

breakpoint_h =	breakpoint.h $(frame_h) $(value_h)

command_h =	command.h
gdbcmd_h =	gdbcmd.h $(command_h)

defs_h =	defs.h xm.h tm.h nm.h config.status config.h

inferior_h =	inferior.h $(breakpoint_h)

# GDB "info" files, which should be included in their entirety
INFOFILES=gdb.info*

REMOTE_EXAMPLES=m68k-stub.c i386-stub.c sparc-stub.c rem-multi.shar

POSSLIBS=gnu-regex.c gnu-regex.h

COMMON_OBS=version.o blockframe.o breakpoint.o findvar.o stack.o thread.o \
	source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o \
	symtab.o symfile.o symmisc.o infcmd.o infrun.o command.o \
	expprint.o environ.o gdbtypes.o copying.o $(DEPFILES) \
	mem-break.o target.o parse.o language.o $(YYOBJ) buildsym.o \
	exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o \
	dbxread.o stabsread.o corefile.o \
	c-lang.o ch-exp.o ch-lang.o f-lang.o m2-lang.o \
	scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \
	c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \
	c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \
	serial.o mdebugread.o top.o utils.o callback.o

OBS=$(COMMON_OBS) $(ANNOTATE_OBS) $(TDEPFILES) main.o $(NATDEPFILES)

LIBGDB_OBS=

TSOBS=inflow.o

NTSOBS=standalone.o

NTSSTART=kdb-start.o

# SUBDIRS=doc testsuite nlm

# For now, shortcut the "configure GDB for fewer languages" stuff.
YYOBJ=c-exp.o f-exp.o m2-exp.o

# Prevent Sun make from putting in the machine type.  Setting
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
.c.o:
	$(CC) -c $(INTERNAL_CFLAGS) $<

all: gdb

# We do this by grepping through sources.  If that turns out to be too slow,
# maybe we could just require every .o file to have an initialization routine
# of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
#
# Formatting conventions:  The name of the _initialize_* routines must start
# in column zero, and must not be inside #if.
#
# Note that the set of files with init functions might change, or the names
# of the functions might change, so this files needs to depend on all the
# object files that will be linked into gdb.

# init.c: $(OBS) $(TSOBS)
init.c:
	@echo Making init.c
	@rm -f init.c-tmp
	@echo '/* Do not modify this file.  */' >init.c-tmp
	@echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
	@echo 'void initialize_all_files () {' >>init.c-tmp
	@for i in $(OBS) $(TSOBS); do \
	  filename=`echo $$i | sed -f gdb.sed ` ; \
	  case $$filename in \
	    "") ;; \
	    *) sed <$(srcdir)/$$filename >>init.c-tmp -n \
	    -e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/  {extern void \1 (); \1 ();}/p' ; ;; \
	  esac ; \
	done
	@echo '}' >>init.c-tmp
	@mv init.c-tmp init.c

.PRECIOUS: init.c

# Removing the old gdb first works better if it is running, at least on SunOS.
gdb: $(OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
	rm -f gdb
	$(CC_LD) $(INTERNAL_LDFLAGS) -o gdb \
init.o $(OBS) $(TSOBS) $(ADD_FILES) $(CLIBS)

nlm:	force
	rootme=`pwd`; export rootme; $(MAKE) $(TARGET_FLAGS_TO_PASS) DO=all DODIRS=nlm subdir_do

libgdb:	libgdb-files $(LIBGDB_OBS)

# libproc is not listed here because all-libproc is a dependency of all-gui,
# not all-gdb, and thus might be built after us.
LIBGDBDEPS=$(COMMON_OBS) $(LIBGDB_OBS) $(TSOBS) $(ADD_DEPS) $(CDEPS) init.o
# libproc needs to be before libiberty for alloca.
LIBGDBFILES=$(COMMON_OBS) $(LIBGDB_OBS) $(TSOBS) ../libproc/libproc.a \
  $(ADD_DEPS) $(CDEPS) init.o

libgdb-files: $(LIBGDBDEPS) Makefile.in
	-rm -f libgdb-files
	for i in $(LIBGDBFILES); do\
		echo $$i >> libgdb-files;\
	done

clean mostlyclean:
	@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(SUBDIRS)" subdir_do 
	rm -f *.o $(ADD_FILES) *~ init.c-tmp
	rm -f init.c version.c
	rm -f gdb core make.log libgdb-files
	rm -f gdb[0-9]

# This used to depend on c-exp.tab.c m2-exp.tab.c TAGS
# I believe this is wrong; the makefile standards for distclean just
# describe removing files; the only sort of "re-create a distribution"
# functionality described is if the distributed files are unmodified.
distclean: clean
	@$(MAKE) $(FLAGS_TO_PASS) DO=distclean "DODIRS=$(SUBDIRS)" subdir_do 
	rm -f nm.h tm.h xm.h config.status config.h stamp-h
	rm -f y.output yacc.acts yacc.tmp y.tab.h
	rm -f config.log config.cache
	rm -f Makefile

maintainer-clean realclean: clean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."
	@$(MAKE) $(FLAGS_TO_PASS) DO=maintainer-clean "DODIRS=$(SUBDIRS)" subdir_do
	rm -f c-exp.tab.c f-exp.tab.c m2-exp.tab.c
	rm -f TAGS $(INFOFILES)
	rm -f nm.h tm.h xm.h config.status
	rm -f y.output yacc.acts yacc.tmp
	rm -f config.log config.cache
	rm -f Makefile

subdir_do: force
	@for i in $(DODIRS); do \
		if [ -f ./$$i/Makefile ] ; then \
			if (cd ./$$i; \
				$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ; \
			else exit 1 ; fi ; \
		else true ; fi ; \
	done

#Makefile: Makefile.in config.status  ./config/i386/fbsd.mh ./config/i386/fbsd.mt
#	$(SHELL) config.status

# Make copying.c from COPYING
copying.c: COPYING
	awk -f $(srcdir)/copying.awk < $(srcdir)/COPYING > copying.c

version.c: Makefile
	echo 'char *version="$(VERSION)";' >version.c
	echo 'char *host_name="$(host_alias)";' >> version.c
	echo 'char *target_name="$(target_alias)";' >> version.c
