# Makefile for GNU F77 stand-alone front end.
#   Copyright (C) 1995 Free Software Foundation, Inc.
#   Contributed by James Craig Burley (burley@gnu.ai.mit.edu).

#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, 675 Mass Ave, Cambridge, MA 02139, USA.

objs=\
parse.o \
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 \
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 \
where.o \
zzz.o

# Use appropriate compiler and options. -Wall will produce complaints about
# certain "fuzzy" (but hand-checked) uses of uninitialized variables, and
# other annoying warnings about uses of assert if assert.h doesn't specify
# it as volatile (effectively). -DNO_STDLIB is needed only on systems where
# including <stdlib.h> won't work (not found or doesn't contain the good
# stuff ANSI says it must).  Similarly, -DLAME_STDIO is needed only on
# systems where the varying-args functions aren't prototyped and you want to
# catch references to non-prototyped functions.  And -DLAME_ASSERT is needed
# if the assert macro is not defined as volatile, effectively, but you
# want to catch certain other warnings.  -DFFE_STANDALONE is what builds
# the front end in stand-alone mode; otherwise it tries to build as GNU
# Fortran (i.e. with the GNU back end).

CC=gcc
CFLAGS=-O6 -g -Wall

ffe: cktyps.out $(objs)
	$(CC) $(CFLAGS) -DFFE_STANDALONE -o ffe $(objs)

cktyps.out: cktyps
	./cktyps > cktyps.out

cktyps: cktyps.o proj.o
	$(CC) $(CFLAGS) -DFFE_STANDALONE -o cktyps cktyps.o proj.o

# Begin results obtained from "make -f Make deps-kinda".
# Note that this command uses the host C compiler; use CC="./xgcc -B./" to
# use GCC in the build directory, for example.

bad.o : bad.c proj.h malloc.h bad.h bad.def where.h top.h com.h bld.h bld-op.def \
  bit.h info.h info-b.def info-k.def info-w.def target.h lex.h intrin.h intrin.def \
  lab.h symbol.h symbol.def equiv.h storag.h global.h name.h 
bit.o : bit.c proj.h malloc.h bit.h 
bld.o : bld.c proj.h malloc.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def 
cktyps.o : cktyps.c proj.h malloc.h target.h bad.h bad.def where.h top.h info.h \
  info-b.def info-k.def info-w.def lex.h 
com.o : com.c proj.h malloc.h com.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 top.h lex.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 malloc.h data.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def expr.h st.h 
equiv.o : equiv.c proj.h malloc.h equiv.h bld.h bld-op.def bit.h com.h info.h \
  info-b.def info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h \
  lab.h storag.h symbol.h symbol.def global.h name.h intrin.h intrin.def data.h 
expr.o : expr.c proj.h malloc.h expr.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def implic.h src.h \
  st.h 
fini.o : fini.c proj.h malloc.h 
g77.o : g77.c config.h 
global.o : global.c proj.h malloc.h global.h lex.h top.h where.h name.h symbol.h \
  symbol.def bad.h bad.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \
  info-w.def target.h lab.h storag.h intrin.h intrin.def equiv.h 
implic.o : implic.c proj.h malloc.h implic.h info.h info-b.def info-k.def info-w.def \
  target.h bad.h bad.def where.h top.h lex.h symbol.h symbol.def bld.h bld-op.def \
  bit.h com.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h src.h 
info.o : info.c proj.h malloc.h info.h info-b.def info-k.def info-w.def target.h \
  bad.h bad.def where.h top.h lex.h 
intrin.o : intrin.c proj.h malloc.h intrin.h intrin.def bld.h bld-op.def bit.h \
  com.h info.h info-b.def info-k.def info-w.def target.h bad.h bad.def where.h \
  top.h lex.h lab.h storag.h symbol.h symbol.def equiv.h global.h name.h src.h 
lab.o : lab.c proj.h malloc.h lab.h com.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 top.h lex.h intrin.h intrin.def \
  symbol.h symbol.def equiv.h storag.h global.h name.h 
lex.o : lex.c proj.h malloc.h top.h where.h bad.h bad.def lex.h src.h 
malloc.o : malloc.c proj.h malloc.h 
name.o : name.c proj.h malloc.h bad.h bad.def where.h top.h name.h global.h \
  lex.h symbol.h symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \
  info-w.def target.h lab.h storag.h intrin.h intrin.def equiv.h src.h 
parse.o : parse.c proj.h malloc.h top.h where.h com.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 intrin.h \
  intrin.def lab.h symbol.h symbol.def equiv.h storag.h global.h name.h zzz.h 
proj.o : proj.c proj.h malloc.h 
src.o : src.c proj.h malloc.h src.h bad.h bad.def where.h top.h 
st.o : st.c proj.h malloc.h st.h bad.h bad.def where.h top.h lex.h symbol.h \
  symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def \
  target.h lab.h storag.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 malloc.h sta.h bad.h bad.def where.h top.h lex.h stamp-str \
  symbol.h symbol.def bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def \
  info-w.def target.h lab.h storag.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 malloc.h stb.h bad.h bad.def where.h top.h expr.h bld.h \
  bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def target.h lex.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 src.h sta.h stc.h 
stc.o : stc.c proj.h malloc.h stc.h bad.h bad.def where.h top.h bld.h bld-op.def \
  bit.h com.h info.h info-b.def info-k.def info-w.def target.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def 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 malloc.h std.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.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 stv.h stw.h sta.h ste.h sts.h 
ste.o : ste.c proj.h malloc.h ste.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.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 sta.h 
storag.o : storag.c proj.h malloc.h storag.h bld.h bld-op.def bit.h com.h info.h \
  info-b.def info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h \
  lab.h symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def data.h 
stp.o : stp.c proj.h malloc.h stp.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stt.h 
str.o : str.c proj.h malloc.h src.h bad.h bad.def where.h top.h stamp-str lex.h 
sts.o : sts.c proj.h malloc.h sts.h com.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 top.h lex.h intrin.h intrin.def \
  lab.h symbol.h symbol.def equiv.h storag.h global.h name.h 
stt.o : stt.c proj.h malloc.h stt.h top.h where.h bld.h bld-op.def bit.h com.h \
  info.h info-b.def info-k.def info-w.def target.h bad.h bad.def lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stp.h expr.h \
  sta.h stamp-str 
stu.o : stu.c proj.h malloc.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def implic.h stu.h \
  sta.h stamp-str 
stv.o : stv.c proj.h malloc.h stv.h lab.h com.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 top.h lex.h \
  intrin.h intrin.def symbol.h symbol.def equiv.h storag.h global.h name.h 
stw.o : stw.c proj.h malloc.h stw.h bld.h bld-op.def bit.h com.h info.h info-b.def \
  info-k.def info-w.def target.h bad.h bad.def where.h top.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def stv.h sta.h \
  stamp-str 
symbol.o : symbol.c proj.h malloc.h symbol.h symbol.def bad.h bad.def where.h \
  top.h bld.h bld-op.def bit.h com.h info.h info-b.def info-k.def info-w.def target.h \
  lex.h lab.h storag.h intrin.h intrin.def equiv.h global.h name.h src.h st.h 
target.o : target.c proj.h malloc.h target.h bad.h bad.def where.h top.h info.h \
  info-b.def info-k.def info-w.def lex.h 
top.o : top.c proj.h malloc.h top.h where.h bad.h bad.def bit.h bld.h bld-op.def \
  com.h info.h info-b.def info-k.def info-w.def target.h lex.h lab.h storag.h \
  symbol.h symbol.def equiv.h global.h name.h intrin.h intrin.def data.h expr.h \
  implic.h src.h st.h 
where.o : where.c proj.h malloc.h lex.h top.h where.h 
zzz.o : zzz.c proj.h malloc.h zzz.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 str-1t

str-2t.h str-2t.j: fini str-2t.fin
	./fini str-2t

str-fo.h str-fo.j: fini str-fo.fin
	./fini str-fo

str-io.h str-io.j: fini str-io.fin
	./fini str-io

str-nq.h str-nq.j: fini str-nq.fin
	./fini str-nq

str-op.h str-op.j: fini str-op.fin
	./fini str-op

str-ot.h str-ot.j: fini str-ot.fin
	./fini str-ot

fini: fini.o proj.o
	$(CC) $(CFLAGS) -DFFE_STANDALONE -o fini fini.o proj.o

deps-kinda: 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
	$(CC) $(CFLAGS) -DFFE_STANDALONE -DMAKING_DEPENDENCIES -MM *.c | \
	  sed -e 's: \([.]/\)*str[.]h : stamp-str :g'

.c.o:
	$(CC) $(CFLAGS) -DFFE_STANDALONE -c $<

clean:
	-rm -f ffe fini cktyps cktyps.out stamp-str *.o str-*.h str-*.j

.PHONY: clean deps-kinda

force:
