blob: 5dbc26a238a899b17be00301321e574f9b5cefe3 [file] [log] [blame]
# Makefile for GNU CHILL compiler.
# Copyright (C) 1987, 88, 90-94, 1998, 1999 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC 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 CC 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 CC; 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.
# It's purpose is to provide support for:
#
# 1) recursion where necessary, and only then (building .o's), and
# 2) building and debugging cc1 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
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.
# CYGNUS LOCAL: we don't use cross-make. Instead we use the tools
# from the build tree, if they are available.
# program_transform_name and objdir are set by configure.in.
program_transform_name =
objdir = .
target= ... `configure' substitutes actual target name here.
xmake_file= ... `configure' substitutes actual x- file name here.
tmake_file= ... `configure' substitutes actual t- file name here.
#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
# Directory where sources are, from where we are.
srcdir = .
# CYGNUS LOCAL
# Directory where texinfo.tex lives
texidir = $(srcdir)/../../texinfo
# 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
####host overrides
####cross overrides
####build overrides
####site overrides
#
# Now figure out from those variables how to compile and link.
all.indirect: Makefile ../chill ../cc1chill$(exeext)
# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
# This is the variable actually used when we compile.
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
# Likewise.
ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
# CYGNUS LOCAL: SUBDIR_USE_ALLOCA is different from FSF.
# 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_USE_ALLOCA = `if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi`
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 -I$(srcdir)/../../include
# Flags to pass to recursive makes.
# ??? $(CC) may need some work to handle stage[123].
# ??? The choices here will need some experimenting with.
FLAGS_TO_PASS = \
"AR_FLAGS=$(AR_FLAGS)" \
"AR_FOR_TARGET=$(AR_FOR_TARGET)" \
"BISON=$(BISON)" \
"BISONFLAGS=$(BISONFLAGS)" \
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
"LDFLAGS=$(LDFLAGS)" \
"LEX=$(LEX)" \
"LEXFLAGS=$(LEXFLAGS)" \
"MAKEINFO=$(MAKEINFO)" \
"MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
"RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"exec_prefix=$(exec_prefix)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"bindir=$(bindir)" \
"libsubdir=$(libsubdir)"
# Always use -I$(srcdir)/config when compiling.
.c.o:
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.
.NOEXPORT:
#
# Lists of files for various purposes.
# Language-specific object files for CHILL
#C_OBJS = ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o
CHILL_OBJS = parse.o actions.o except.o grant.o lang.o \
tree.o lex.o decl.o typeck.o convert.o expr.o loop.o \
tasking.o timing.o inout.o satisfy.o ch-version.o
# Language-independent object files.
OBJS = `cat ../stamp-objlist`
OBJDEPS = ../stamp-objlist
../cc1chill$(exeext): $(P) $(CHILL_OBJS) $(OBJDEPS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CHILL_OBJS) \
$(OBJS) $(C_OBJS) $(LIBS)
# This executable is used in the CHILL regression
# test script
utils/printf : $(srcdir)/utils/printf.c
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $<
#
# This is the top-level trigger for a CHILL regression test.
# It also builds those tools needed for CHILL regression testing.
#
check: ../cc1chill$(exeext) utils/printf
cd ..; $(MAKE) $(FLAGS_TO_PASS) xgcc gcov cpp cc1 ld
$(srcdir)/regression.sh -d -p
clean-tests:
cd testsuite/execute; $(MAKE) clean
cd testsuite/execute/oe; $(MAKE) clean
cd testsuite/compile/elektra; $(MAKE) clean
cd testsuite/compile/votrics; $(MAKE) clean
cd testsuite/compile; $(MAKE) clean
cd testsuite/noncompile; $(MAKE) clean
cd testsuite/examples; $(MAKE) clean
mostlyclean:
test -d testsuite && $(MAKE) clean-tests
rm -f *.o
clean: mostlyclean
#
Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
cd ..; $(SHELL) config.status
native: config.status ../cc1chill$(exeext) ../chill
#
# Compiling object files from source files.
# Note that dependencies on obstack.h are not written
# because that file is not part of GCC.
# CHILL language specific files.
RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CHILL_TREE_H = $(TREE_H) ch-tree.h ch-tree.def
# hash.h really depends on $(srcdir)/gperf.
# But this would screw things for people that don't have gperf,
# if gperf got touched, say.
# Thus you have to remove hash.h to force it to be re-made.
# Note: CHILL requires two sets of keywords, one all uppercase and
# one all lowercase. The hash table ends up with both sets in it.
$(srcdir)/hash.h:
sed -e '1,/^%%/d' < $(srcdir)/gperf | \
sed '/^[^a-zA-Z]/d' | tr "[a-z]" "[A-Z]" > gperf.tmp
gawk '{ printf ("s/^%s,/%s,/\n", $$1, toupper ($$1)) }' < gperf.tmp > sed.tmp
sed -f sed.tmp < gperf.tmp > gperf.tmp2
cat $(srcdir)/gperf gperf.tmp2 > gperf.tmp
gperf -L C -F ', 0, 0, 0' -D -E -S1 -p -j1 -i 1 -g -o -t -k'*' \
gperf.tmp > $(srcdir)/hash.h
$(RM) gperf.tmp gperf.tmp2 sed.tmp
actions.o : actions.c $(CONFIG_H) $(CHILL_TREE_H) actions.h $(RTL_H) \
lex.h $(srcdir)/../flags.h $(srcdir)/../../include/obstack.h \
$(srcdir)/../input.h $(srcdir)/../expr.h ../insn-codes.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
convert.o : convert.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../tree.h $(srcdir)/../system.h $(srcdir)/../toplev.h
decl.o : decl.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
except.o : except.c $(CONFIG_H) $(srcdir)/../tree.h $(RTL_H) $(CHILL_TREE_H) \
$(srcdir)/../system.h $(srcdir)/../toplev.h
expr.o : expr.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../expr.h ../insn-codes.h $(srcdir)/../tree.h lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
grant.o: grant.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h lex.h actions.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../output.h
inout.o : inout.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h $(srcdir)/../system.h $(srcdir)/../toplev.h
lang.o : lang.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../input.h lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
lex.o : lex.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h $(srcdir)/parse.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../../include/obstack.h lex.h \
$(srcdir)/../dwarfout.h hash.h
loop.o : loop.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) lex.h \
$(srcdir)/../flags.h $(srcdir)/../input.h \
$(srcdir)/../../include/obstack.h $(srcdir)/../tree.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
parse.o : parse.c $(CONFIG_H) $(CHILL_TREE_H) parse.h \
lex.h actions.h tasking.h $(srcdir)/../system.h $(srcdir)/../toplev.h
satisfy.o : satisfy.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../tree.h \
$(srcdir)/../flags.h lex.h $(srcdir)/../system.h $(srcdir)/../toplev.h
timing.o : timing.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h $(srcdir)/../../include/obstack.h lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
tasking.o : tasking.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) \
$(srcdir)/../flags.h $(srcdir)/../input.h \
$(srcdir)/../../include/obstack.h lex.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h
tree.o : tree.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h
typeck.o : typeck.c $(CONFIG_H) $(CHILL_TREE_H) ../insn-codes.h \
$(srcdir)/../expr.h ../insn-codes.h $(srcdir)/../flags.h lex.h \
$(srcdir)/../system.h $(srcdir)/../toplev.h
ch-version.o : ch-version.c
ch-version.c : Makefile
echo 'char *gnuchill_version = "$(GNUCHILL_VERSION)";' > $@
## This is ugly, but I don't want GNU make to put these variables in
## the environment. Older makes will see this as a set of targets
## with no dependencies and no actions.
unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET :
# These exist for maintenance purposes.
# Update the tags table.
TAGS: force
cd $(srcdir); \
etags *.y *.h *.c *.l ../*.h ../*.c; \
.PHONY: TAGS
force: