# Makefile for GNU F77 compiler.
#   Copyright (C) 1995-1998 Free Software Foundation, Inc.

#This file is part of GNU Fortran.

#GNU Fortran 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, or (at your option)
#any later version.

#GNU Fortran 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 GNU Fortran; see the file COPYING.  If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#02111-1307, USA.

# The makefile built from this file lives in the language subdirectory.
# Its purpose is to provide support for:
#
# 1) recursion where necessary, and only then (building .o's), and
# 2) building and debugging f771 from the language subdirectory, and
# 3) nothing else.
#
# The parent makefile handles all other chores, with help from the
# language makefile fragment, of course.
#
# The targets for external use are:
# all, TAGS, ???mostlyclean, ???clean.

# Suppress smart makes who think they know how to automake Yacc files
.y.c:

# Variables that exist for you to override.
# See below for how to change them for certain systems.

ALLOCA =

# Various ways of specifying flags for compilations:
# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
# BOOT_CFLAGS is the value of CFLAGS to pass
# to the stage2 and stage3 compilations
# XCFLAGS is used for most compilations but not when using the GCC just built.
XCFLAGS =
CFLAGS = -g
BOOT_CFLAGS = -O $(CFLAGS)
# These exists to be overridden by the x-* and t-* files, respectively.
X_CFLAGS =
T_CFLAGS =

X_CPPFLAGS =
T_CPPFLAGS =

CC = @CC@
BISON = bison
BISONFLAGS =
LEX = flex
LEXFLAGS =
AR = ar
AR_FLAGS = rc
SHELL = /bin/sh
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi

# Define this as & to perform parallel make on a Sequent.
# Note that this has some bugs, and it seems currently necessary
# to compile all the gen* files first by hand to avoid erroneous results.
P =

# This is used in the definition of SUBDIR_USE_ALLOCA.
# ??? Perhaps it would be better if it just looked for *gcc*.
OLDCC = cc

# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
# It omits XCFLAGS, and specifies -B./.
# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)

# Tools to use when building a cross-compiler.
# These are used because `configure' appends `cross-make'
# to the makefile when making a cross-compiler.

target=@target@
xmake_file=@dep_host_xmake_file@
tmake_file=@dep_tmake_file@

# Directory where sources are, from where we are.
srcdir = @srcdir@
VPATH = @srcdir@

# Additional system libraries to link with.
CLIB=

# Change this to a null string if obstacks are installed in the
# system library.
OBSTACK=obstack.o

# Choose the real default target.
ALL=all

# End of variables for you to override.

# Definition of `all' is here so that new rules inserted by sed
# do not specify the default target.
all: all.indirect

# This tells GNU Make version 3 not to put all variables in the environment.
.NOEXPORT:

# sed inserts variable overrides after the following line.
####target overrides
@target_overrides@
####host overrides
@host_overrides@
####cross overrides
@cross_defines@
@cross_overrides@
####build overrides
@build_overrides@
#
# Now figure out from those variables how to compile and link.

all.indirect: Makefile ../f771$(exeext)

# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@

# This is the variable actually used when we compile.
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) -W -Wall

# Likewise.
ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)

# f771 is so big, need to tell linker on m68k-next-nextstep* to make enough
# room for it.  On AIX, linking f771 overflows the linker TOC;
# `-bbigtoc' is appropriate for the linker on AIX 4.1 and above.
F771_LDFLAGS = `case "${target}" in\
 m68k-next-nextstep*) echo -segaddr __DATA 6000000;;\
 *-*-aix[4-9]*) \`$(CC) --print-prog-name=ld\` -v 2>&1 | grep BFD >/dev/null || echo -Wl,-bbigtoc;; esac`

# Even if ALLOCA is set, don't use it if compiling with GCC.

SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`

# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB)

# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config

# Always use -I$(srcdir)/config when compiling.
.c.o:
	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<

#
# Lists of files for various purposes.

# Language-specific object files for g77

F77_OBJS = \
 bad.o \
 bit.o \
 bld.o \
 com.o \
 data.o \
 equiv.o \
 expr.o \
 global.o \
 implic.o \
 info.o \
 intrin.o \
 lab.o \
 lex.o \
 malloc.o \
 name.o \
 parse.o \
 proj.o \
 src.o \
 st.o \
 sta.o \
 stb.o \
 stc.o \
 std.o \
 ste.o \
 storag.o \
 stp.o \
 str.o \
 sts.o \
 stt.o \
 stu.o \
 stv.o \
 stw.o \
 symbol.o \
 target.o \
 top.o \
 type.o \
 version.o \
 where.o

# Language-independent object files.
OBJS = `cat ../stamp-objlist`
OBJDEPS = ../stamp-objlist

compiler: ../f771$(exeext)
../f771$(exeext): $(P) $(F77_OBJS) $(OBJDEPS) $(LIBDEPS)
	rm -f f771$(exeext)
	@echo $(CC) $(ALL_CFLAGS) $(LDFLAGS) $(F771_LDFLAGS) -o $@ \
	      $(F77_OBJS) $(OBJS) $(LIBS)
	@$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(F771_LDFLAGS) -o $@ \
	      $(F77_OBJS) $(OBJS) $(LIBS); \
	errcode=$$?; \
	if [ $$errcode != 0 ]; then \
	  echo ""; \
	  echo "If the above command failed due to an unresolved reference"; \
	  echo "to strtoul, _strtoul, bsearch, _bsearch, or similar, see"; \
	  echo "[info -f g77 M LINKFAIL] (a node in the g77 documentation)"; \
	  echo "for information on what causes this, how to work around"; \
	  echo "the problem by editing ${srcdir}/proj.c, and what else to do."; \
	  echo ""; \
	  exit $$errcode; \
	fi

Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
	cd ..; $(SHELL) config.status

native: config.status ../f771$(exeext)
#
# Compiling object files from source files.

# Note that dependencies on obstack.h are not written
# because that file is not part of GCC.

# F77 language-specific files.

# These macros expand to the corresponding g77-source .j files plus
# the gcc-source files involved (each file itself, plus whatever
# files on which it depends, but without including stuff resulting
# from configuration, since we can't guess at that).  The files
# that live in a distclean'd gcc source directory have "$(srcdir)/"
# prefixes, while the others don't because they'll be created
# only in the build directory.
ASSERT_H = $(srcdir)/assert.j $(srcdir)/../assert.h
CONFIG_H = $(srcdir)/config.j ../config.h
CONVERT_H = $(srcdir)/convert.j $(srcdir)/../convert.h
FLAGS_H = $(srcdir)/flags.j $(srcdir)/../flags.h
GLIMITS_H = $(srcdir)/glimits.j $(srcdir)/../glimits.h
HCONFIG_H = $(srcdir)/hconfig.j ../hconfig.h
INPUT_H = $(srcdir)/input.j $(srcdir)/../input.h
OUTPUT_H = $(srcdir)/output.j $(srcdir)/../output.h
RTL_H = $(srcdir)/rtl.j $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
	$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TCONFIG_H = $(srcdir)/tconfig.j ../tconfig.h
TM_H = $(srcdir)/tm.j ../tm.h
TREE_H = $(srcdir)/tree.j $(srcdir)/../tree.h $(srcdir)/../real.h \
	$(srcdir)/../tree.def $(srcdir)/../machmode.h $(srcdir)/../machmode.def

#Build the first part of this list with the command line:
#    cd gcc/; make deps-kinda -f f/Makefile.in
#Note that this command uses the host C compiler;
# use HOST_CC="./xgcc -B./" to use GCC in the build directory, for example.
#Also note that this particular build file seems to want to use
# substitions: $(CONFIG_H) for config.h; $(TREE_H) for tree.h; and
# $(RTL_H) for rtl.h.  deps-kinda uses a sed script to do those
# substitutions, plus others for elegance.

ansify.o: ansify.c $(ASSERT_H)
bad.o: bad.c proj.h $(CONFIG_H) $(ASSERT_H) bad.h bad.def where.h $(GLIMITS_H) \
 top.h malloc.h $(FLAGS_H) com.h com-rt.def $(TREE_H) bld.h bld-op.def bit.h \
 info.h info-b.def info-k.def info-w.def target.h lex.h type.h \
 intrin.h intrin.def lab.h symbol.h symbol.def equiv.h storag.h \
 global.h name.h $(RTL_H)
bit.o: bit.c proj.h $(CONFIG_H) $(ASSERT_H) $(GLIMITS_H) bit.h malloc.h
bld.o: bld.c proj.h $(CONFIG_H) $(ASSERT_H) bld.h bld-op.def bit.h malloc.h \
 com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def info-w.def \
 target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h type.h lab.h \
 storag.h symbol.h symbol.def equiv.h global.h name.h intrin.h \
 intrin.def $(RTL_H)
com.o: com.c proj.h $(CONFIG_H) $(ASSERT_H) $(FLAGS_H) $(RTL_H) $(TREE_H) $(OUTPUT_H) \
 $(CONVERT_H) com.h com-rt.def bld.h bld-op.def bit.h malloc.h info.h \
 info-b.def info-k.def info-w.def target.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h lex.h type.h intrin.h intrin.def lab.h symbol.h \
 symbol.def equiv.h storag.h global.h name.h expr.h implic.h src.h \
 st.h
data.o: data.c proj.h $(CONFIG_H) $(ASSERT_H) data.h bld.h bld-op.def bit.h \
 malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h \
 intrin.h intrin.def $(RTL_H) expr.h st.h
equiv.o: equiv.c proj.h $(CONFIG_H) $(ASSERT_H) equiv.h bld.h bld-op.def \
 bit.h malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def global.h name.h intrin.h \
 intrin.def $(RTL_H) data.h
expr.o: expr.c proj.h $(CONFIG_H) $(ASSERT_H) expr.h bld.h bld-op.def bit.h \
 malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h \
 intrin.h intrin.def $(RTL_H) implic.h src.h st.h stamp-str
fini.o: fini.c proj.h $(CONFIG_H) $(ASSERT_H) malloc.h
global.o: global.c proj.h $(CONFIG_H) $(ASSERT_H) global.h info.h info-b.def \
 info-k.def info-w.def target.h $(TREE_H) bad.h bad.def where.h $(GLIMITS_H) \
 top.h malloc.h lex.h type.h name.h symbol.h symbol.def bld.h \
 bld-op.def bit.h com.h com-rt.def lab.h storag.h $(RTL_H) intrin.h \
 intrin.def equiv.h
implic.o: implic.c proj.h $(CONFIG_H) $(ASSERT_H) implic.h info.h info-b.def \
 info-k.def info-w.def target.h $(TREE_H) bad.h bad.def where.h $(GLIMITS_H) \
 top.h malloc.h lex.h type.h symbol.h symbol.def bld.h bld-op.def \
 bit.h com.h com-rt.def lab.h storag.h $(RTL_H) intrin.h intrin.def \
 equiv.h global.h name.h src.h
info.o: info.c proj.h $(CONFIG_H) $(ASSERT_H) info.h info-b.def info-k.def \
 info-w.def target.h $(TREE_H) bad.h bad.def where.h $(GLIMITS_H) top.h \
 malloc.h lex.h type.h
intdoc.o: intdoc.c $(ASSERT_H) intrin.h intrin.def intdoc.h0 intdoc.h0
intrin.o: intrin.c proj.h $(CONFIG_H) $(ASSERT_H) intrin.h intrin.def bld.h \
 bld-op.def bit.h malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def \
 info-k.def info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h \
 lex.h type.h lab.h storag.h symbol.h symbol.def equiv.h global.h \
 name.h $(RTL_H) expr.h src.h
lab.o: lab.c proj.h $(CONFIG_H) $(ASSERT_H) lab.h com.h com-rt.def $(TREE_H) \
 bld.h bld-op.def bit.h malloc.h info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h intrin.h intrin.def symbol.h symbol.def equiv.h storag.h \
 global.h name.h $(RTL_H)
lex.o: lex.c proj.h $(CONFIG_H) $(ASSERT_H) top.h malloc.h where.h $(GLIMITS_H) \
 bad.h bad.def com.h com-rt.def $(TREE_H) bld.h bld-op.def bit.h info.h \
 info-b.def info-k.def info-w.def target.h lex.h type.h intrin.h \
 intrin.def lab.h symbol.h symbol.def equiv.h storag.h global.h name.h \
 $(RTL_H) src.h $(FLAGS_H) $(INPUT_H) $(OUTPUT_H)
malloc.o: malloc.c proj.h $(CONFIG_H) $(ASSERT_H) malloc.h
name.o: name.c proj.h $(CONFIG_H) $(ASSERT_H) bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h name.h global.h info.h info-b.def info-k.def \
 info-w.def target.h $(TREE_H) lex.h type.h symbol.h symbol.def bld.h \
 bld-op.def bit.h com.h com-rt.def lab.h storag.h $(RTL_H) intrin.h \
 intrin.def equiv.h src.h
parse.o: parse.c proj.h $(CONFIG_H) $(ASSERT_H) top.h malloc.h where.h \
 $(GLIMITS_H) com.h com-rt.def $(TREE_H) bld.h bld-op.def bit.h info.h \
 info-b.def info-k.def info-w.def target.h bad.h bad.def lex.h type.h \
 intrin.h intrin.def lab.h symbol.h symbol.def equiv.h storag.h \
 global.h name.h $(RTL_H) version.h $(FLAGS_H)
proj.o: proj.c proj.h $(CONFIG_H) $(ASSERT_H) $(GLIMITS_H)
src.o: src.c proj.h $(CONFIG_H) $(ASSERT_H) src.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h
st.o: st.c proj.h $(CONFIG_H) $(ASSERT_H) st.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h lex.h symbol.h symbol.def bld.h bld-op.def \
 bit.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def info-w.def \
 target.h type.h lab.h storag.h $(RTL_H) intrin.h intrin.def equiv.h \
 global.h name.h sta.h stamp-str stb.h expr.h stp.h stt.h stc.h std.h \
 stv.h stw.h ste.h sts.h stu.h
sta.o: sta.c proj.h $(CONFIG_H) $(ASSERT_H) sta.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h lex.h stamp-str symbol.h symbol.def bld.h \
 bld-op.def bit.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h type.h lab.h storag.h $(RTL_H) intrin.h intrin.def \
 equiv.h global.h name.h implic.h stb.h expr.h stp.h stt.h stc.h std.h \
 stv.h stw.h
stb.o: stb.c proj.h $(CONFIG_H) $(ASSERT_H) stb.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h expr.h bld.h bld-op.def bit.h com.h \
 com-rt.def $(TREE_H) info.h info-b.def info-k.def info-w.def target.h \
 lex.h type.h lab.h storag.h symbol.h symbol.def equiv.h global.h \
 name.h intrin.h intrin.def $(RTL_H) stp.h stt.h stamp-str src.h sta.h stc.h
stc.o: stc.c proj.h $(CONFIG_H) $(ASSERT_H) stc.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h bld.h bld-op.def bit.h com.h com-rt.def \
 $(TREE_H) info.h info-b.def info-k.def info-w.def target.h lex.h type.h \
 lab.h storag.h symbol.h symbol.def equiv.h global.h name.h intrin.h \
 intrin.def $(RTL_H) expr.h stp.h stt.h stamp-str data.h implic.h src.h sta.h \
 std.h stv.h stw.h
std.o: std.c proj.h $(CONFIG_H) $(ASSERT_H) std.h bld.h bld-op.def bit.h \
 malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h \
 intrin.h intrin.def $(RTL_H) stp.h stt.h stamp-str stv.h stw.h sta.h ste.h \
 sts.h
ste.o: ste.c proj.h $(CONFIG_H) $(ASSERT_H) $(RTL_H) $(TREE_H) $(OUTPUT_H) ste.h \
 bld.h bld-op.def bit.h malloc.h com.h com-rt.def info.h info-b.def \
 info-k.def info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h \
 lex.h type.h lab.h storag.h symbol.h symbol.def equiv.h global.h \
 name.h intrin.h intrin.def stp.h stt.h stamp-str sts.h stv.h stw.h expr.h \
 sta.h
storag.o: storag.c proj.h $(CONFIG_H) $(ASSERT_H) storag.h bld.h bld-op.def \
 bit.h malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h symbol.h symbol.def equiv.h global.h name.h intrin.h \
 intrin.def $(RTL_H) data.h
stp.o: stp.c proj.h $(CONFIG_H) $(ASSERT_H) stp.h bld.h bld-op.def bit.h \
 malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h \
 intrin.h intrin.def $(RTL_H) stt.h
str.o: str.c proj.h $(CONFIG_H) $(ASSERT_H) src.h bad.h bad.def where.h \
 $(GLIMITS_H) top.h malloc.h stamp-str lex.h
sts.o: sts.c proj.h $(CONFIG_H) $(ASSERT_H) sts.h malloc.h com.h com-rt.def \
 $(TREE_H) bld.h bld-op.def bit.h info.h info-b.def info-k.def info-w.def \
 target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h type.h intrin.h \
 intrin.def lab.h symbol.h symbol.def equiv.h storag.h global.h name.h \
 $(RTL_H)
stt.o: stt.c proj.h $(CONFIG_H) $(ASSERT_H) stt.h top.h malloc.h where.h \
 $(GLIMITS_H) bld.h bld-op.def bit.h com.h com-rt.def $(TREE_H) info.h \
 info-b.def info-k.def info-w.def target.h bad.h bad.def lex.h type.h \
 lab.h storag.h symbol.h symbol.def equiv.h global.h name.h intrin.h \
 intrin.def $(RTL_H) stp.h expr.h sta.h stamp-str
stu.o: stu.c proj.h $(CONFIG_H) $(ASSERT_H) bld.h bld-op.def bit.h malloc.h \
 com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def info-w.def \
 target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h type.h lab.h \
 storag.h symbol.h symbol.def equiv.h global.h name.h intrin.h \
 intrin.def $(RTL_H) implic.h stu.h sta.h stamp-str
stv.o: stv.c proj.h $(CONFIG_H) $(ASSERT_H) stv.h lab.h com.h com-rt.def \
 $(TREE_H) bld.h bld-op.def bit.h malloc.h info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h intrin.h intrin.def symbol.h symbol.def equiv.h storag.h \
 global.h name.h $(RTL_H)
stw.o: stw.c proj.h $(CONFIG_H) $(ASSERT_H) stw.h bld.h bld-op.def bit.h \
 malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def info-k.def \
 info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h lex.h \
 type.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h \
 intrin.h intrin.def $(RTL_H) stv.h sta.h stamp-str
symbol.o: symbol.c proj.h $(CONFIG_H) $(ASSERT_H) symbol.h symbol.def bld.h \
 bld-op.def bit.h malloc.h com.h com-rt.def $(TREE_H) info.h info-b.def \
 info-k.def info-w.def target.h bad.h bad.def where.h $(GLIMITS_H) top.h \
 lex.h type.h lab.h storag.h $(RTL_H) intrin.h intrin.def equiv.h \
 global.h name.h src.h st.h
target.o: target.c proj.h $(CONFIG_H) $(ASSERT_H) $(GLIMITS_H) target.h $(TREE_H) \
 bad.h bad.def where.h top.h malloc.h info.h info-b.def info-k.def \
 info-w.def type.h lex.h
top.o: top.c proj.h $(CONFIG_H) $(ASSERT_H) top.h malloc.h where.h $(GLIMITS_H) \
 bad.h bad.def bit.h bld.h bld-op.def com.h com-rt.def $(TREE_H) info.h \
 info-b.def info-k.def info-w.def target.h lex.h type.h lab.h storag.h \
 symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def $(RTL_H) \
 data.h expr.h implic.h src.h st.h $(FLAGS_H)
type.o: type.c proj.h $(CONFIG_H) $(ASSERT_H) type.h malloc.h
version.o: version.c
where.o: where.c proj.h $(CONFIG_H) $(ASSERT_H) where.h $(GLIMITS_H) top.h \
 malloc.h lex.h

# The rest of this list (Fortran 77 language-specific files) is hand-generated.

stamp-str: str-1t.h str-1t.j str-2t.h str-2t.j \
 str-fo.h str-fo.j str-io.h str-io.j str-nq.h  str-nq.j \
 str-op.h str-op.j str-ot.h str-ot.j
	touch stamp-str

str-1t.h str-1t.j: fini str-1t.fin
	./fini `echo $(srcdir)/str-1t.fin | sed 's,^\./,,'` str-1t.j str-1t.h

str-2t.h str-2t.j: fini str-2t.fin
	./fini `echo $(srcdir)/str-2t.fin | sed 's,^\./,,'` str-2t.j str-2t.h

str-fo.h str-fo.j: fini str-fo.fin
	./fini `echo $(srcdir)/str-fo.fin | sed 's,^\./,,'` str-fo.j str-fo.h

str-io.h str-io.j: fini str-io.fin
	./fini `echo $(srcdir)/str-io.fin | sed 's,^\./,,'` str-io.j str-io.h

str-nq.h str-nq.j: fini str-nq.fin
	./fini `echo $(srcdir)/str-nq.fin | sed 's,^\./,,'` str-nq.j str-nq.h

str-op.h str-op.j: fini str-op.fin
	./fini `echo $(srcdir)/str-op.fin | sed 's,^\./,,'` str-op.j str-op.h

str-ot.h str-ot.j: fini str-ot.fin
	./fini `echo $(srcdir)/str-ot.fin | sed 's,^\./,,'` str-ot.j str-ot.h

fini: fini.o proj-h.o
	$(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o fini fini.o proj-h.o

fini.o:
	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
	      `echo $(srcdir)/fini.c | sed 's,^\./,,'` -o $@

proj-h.o: proj.o
	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
	      `echo $(srcdir)/proj.c | sed 's,^\./,,'` -o $@

# Other than str-*.j, the *.j files are dummy #include files
# that normally just #include the corresponding back-end *.h
# files, but not if MAKING_DEPENDENCIES is #defined.  The str-*.j
# files also are not actually included if MAKING_DEPENDENCIES
# is #defined.  The point of all this is to come up with a clean
# dependencies list whether working in a clean directory, such
# that str-*.j and such do not exist, or in a directory full
# of already-built files.  Any dependency on a str-*.j file
# implies a dependency on str.h, so we key on that to replace
# it with stamp-str, and dependencies on the other *.j files
# are generally left alone (modulo special macros like RTL_H)
# because we might not want to recompile all of g77 just
# because a back-end file changes.  MG is usually "-MG" but
# should be defined with "make MG= deps-kinda..." if using
# a compiler that doesn't support -MG (gcc does as of 2.6) --
# it prevents diagnostics when an #include file is missing,
# as will be the case with proj.h in a clean directory.
MG=-MG
deps-kinda:
	$(HOST_CC) -DMAKING_DEPENDENCIES -MM $(MG) *.c | \
	  sed -e 's: \([.]/\)*assert[.]j: $$(ASSERT_H):g' \
	      -e 's: \([.]/\)*config[.]j: $$(CONFIG_H):g' \
	      -e 's: \([.]/\)*convert[.]j: $$(CONVERT_H):g' \
	      -e 's: \([.]/\)*flags[.]j: $$(FLAGS_H):g' \
	      -e 's: \([.]/\)*glimits[.]j: $$(GLIMITS_H):g' \
	      -e 's: \([.]/\)*hconfig[.]j: $$(HCONFIG_H):g' \
	      -e 's: \([.]/\)*input[.]j: $$(INPUT_H):g' \
	      -e 's: \([.]/\)*output[.]j: $$(OUTPUT_H):g' \
	      -e 's: \([.]/\)*rtl[.]j: $$(RTL_H):g' \
	      -e 's: \([.]/\)*tconfig[.]j: $$(TCONFIG_H):g' \
	      -e 's: \([.]/\)*tm[.]j: $$(TM_H):g' \
	      -e 's: \([.]/\)*tree[.]j: $$(TREE_H):g' \
	      -e 's: \([.]/\)*str[.]h: stamp-str:g' \
	      -e 's:.*g77spec.*::g' \
	      -e 's%^\(.*\)[ ]*: %\1: %g'

# This rule is just a handy way to build the g77 derived files without
# having the gcc source tree around.
g77-only: force
	if [ -f g77.texi ] ; then \
	  (cd ..; $(MAKE) srcdir=. HOST_CC=cc HOST_CFLAGS=-g -f f/Make-lang.in f77.rebuilt); \
	else \
	  $(MAKE) srcdir=. HOST_CC=cc HOST_CFLAGS=-g -f f/Make-lang.in f77.rebuilt; \
	fi

#
# These exist for maintenance purposes.

# Update the tags table.
TAGS: force
	cd $(srcdir)/f ;			\
	etags *.c *.h ;				\
	echo 'l' | tr 'l' '\f' >> TAGS ;	\
	etags -a ../*.h ../*.c;

.PHONY: none all all.indirect f77.rebuilt compiler native deps-kinda g77-only TAGS force

force:
