# with or for libgcc1.a.
LIBGCC1 = libgcc1.a
+# Specify the rule for making libgcc1.a for a cross-compiler.
+# The default rule assumes that libgcc1.a is supplied by the user.
+CROSS_LIBGCC1 = libgcc1.cross
+
# Specify the rule for actually making libgcc2.a.
LIBGCC2 = libgcc2.a
stamp-attr stamp-attrtab stamp-opinit stamp-proto \
genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
genattrtab genattr genopinit \
- $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp \
+ $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp g++ g++-cross \
cc1plus cc1obj enquire protoize unprotoize specs collect2 $(USE_COLLECT2)
# Members of libgcc1.a.
# Header files that are made available under the same name
# to programs compiled with GCC.
-USER_H = va-alpha.h va-i860.h va-i960.h va-mips.h va-m88k.h \
+USER_H = va-alpha.h va-h8300.h va-i860.h va-i960.h va-mips.h va-m88k.h \
va-pa.h va-pyr.h va-sparc.h va-clipper.h va-spur.h proto.h $(EXTRA_HEADERS)
# The files that "belong" in CONFIG_H are deliberately omitted
# This is what to compile if making a cross-compiler.
# Note that we can compile enquire using the cross-compiler just build,
# although we can't run it on this machine.
-all.cross: native gcc-cross specs $(LIBGCC) stmp-headers $(STMP_FIXPROTO) cross-test enquire $(EXTRA_PARTS)
+all.cross: native gcc-cross g++-cross specs $(LIBGCC) stmp-headers $(STMP_FIXPROTO) cross-test enquire $(EXTRA_PARTS)
# This is what to compile if making gcc with a cross-compiler.
-all.build: native xgcc $(EXTRA_PARTS)
+all.build: native xgcc g++ $(EXTRA_PARTS)
# This is what must be made before installing GCC and converting libraries.
-start.encap: native xgcc specs $(LIBGCC1) xlimits.h
+start.encap: native xgcc g++ specs $(LIBGCC1) xlimits.h
# Use this to make a GCC that will be used only to recompile GCC.
for-bootstrap: start.encap $(LIBGCC)
# These can't be made, with COFF encapsulation, until after GCC can run.
specs: xgcc
$(GCC_FOR_TARGET) -dumpspecs > specs
+# Create the compiler driver for g++.
+g++: g++.o $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o g++ g++.o $(LIBS)
+
# We do want to create an executable named `xgcc', so we can use it to
# compile libgcc2.a.
# Also create gcc-cross, so that install-common will install properly.
gcc-cross: xgcc
cp xgcc gcc-cross
+# Create a version of the g++ driver which calls the cross-compiler.
+g++-cross: $(srcdir)/g++.c
+ $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
+ -DGCC_NAME=\"$(target)-gcc\" $(srcdir)/g++.c version.o $(LIBS)
+
cc1:$(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
# so that libgcc1.a itself remains nonexistent if compilation is aborted.
# -e causes any failing command to make this rule fail.
# -e doesn't work in certain shells, so we test $$? as well.
- set -e; \
+# lynx has a broken ar, it always complains when the initial library is
+# empty, thus this command works only if we don't do -e
+# There is a trailing backslash (\) deleted from the following line.
+# set -e;
for name in $(LIB1FUNCS); \
do \
echo $${name}; \
-rm -f tmplibgcc2.a
# -e causes any failing command to make this rule fail.
# -e doesn't work in certain shells, so we test $$? as well.
- set -e; \
+# lynx has a broken ar, it always complains when the initial library is
+# empty, thus this command works only if we don't do -e
+# There is a trailing backslash (\) deleted from the following line.
+# set -e;
for name in $(LIB2FUNCS); \
do \
echo $${name}; \
then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
else true; \
fi
+# Some versions of ar (specifically the one in RISC/os 5.x), create an
+# unwritable table of contents file, and then print an error message when
+# the second ar command tries to overwrite this file. To avoid the error
+# message from ar, we make sure all files are writable.
+ (cd tmpcopy; chmod +w * > /dev/null 2>&1)
(cd tmpcopy; $(AR) x ../$(LIBGCC2))
(cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
rm -rf tmpcopy
flags.h output.h
sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
flags.h insn-config.h insn-attr.h
-final.o : final.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h regs.h \
+final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) gvarargs.h flags.h regs.h \
recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
recog.o : recog.c $(CONFIG_H) $(RTL_H) \
touch stmp-headers
# Build fixed copies of system files.
-stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h
+stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h xgcc cpp
rm -rf include
mkdir include
if [ x$(FIXINCLUDES) != xMakefile.in ]; \
for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
if [ -d $$dir ]; \
then \
- $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir); \
+ $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir) "`pwd`/xgcc -B`pwd`/"; \
else true; fi; \
done; \
else true; \
${HOST_CC} -o gen-protos gen-protos.o scan.o
xsys-protos.h: $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
- cat deduced.h $(srcdir)/sys-protos.h |\
- sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' >tmp.c
- $(GCC_FOR_TARGET) tmp.c -E | ./gen-protos >xsys-protos.h
+ cat deduced.h $(srcdir)/sys-protos.h > fixtmp.c
+ $(GCC_FOR_TARGET) fixtmp.c -E \
+ | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
+ | ./gen-protos >xsys-protos.h
+ rm -rf fixtmp.c
scan-decls: scan-decls.o scan.o
$(HOST_CC) -o scan-decls scan-decls.o scan.o
-patch-header: patch-header.o scan.o xsys-protos.h obstack.o
- $(HOST_CC) -o patch-header patch-header.o scan.o obstack.o
+patch-header: patch-header.o scan.o xsys-protos.h $(HOST_OBSTACK)
+ $(HOST_CC) -o patch-header patch-header.o scan.o $(HOST_OBSTACK)
patch-header.o: xsys-protos.h
-rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
-rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
# Delete files generated for fixproto
- rm -rf patch-header scan-decls xsys-protos.h deduced.h tmp-deduced.h \
- tmp.i tmp.c
+ -rm -rf patch-header scan-decls xsys-protos.h deduced.h tmp-deduced.h \
+ gen-protos fixproto.list fixtmp.?
# Delete unwanted output files from TeX.
-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
# Delete sorted indices we don't actually use.
# Install the compiler executables built during cross compilation.
# Deps on $(srcdir)/g++ $(srcdir)/c++ would be natural here,
# but the latter would get confused with the target `c++'.
-install-common: native install-dir xgcc $(EXTRA_PARTS)
+install-common: native install-dir xgcc g++ $(EXTRA_PARTS)
for file in $(COMPILERS); do \
if [ -f $$file ] ; then \
rm -f $(libsubdir)/$$file; \
rm -f $(tooldir)/bin/gcc; \
$(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
else true; fi; \
+ if [ -f cc1plus ] ; then \
+ rm -f $(bindir)/$(target)-g++; \
+ $(INSTALL_PROGRAM) g++-cross $(bindir)/$(target)-g++; \
+ chmod a+x $(bindir)/$(target)-g++; \
+ rm -f $(bindir)/$(target)-c++; \
+ ln $(bindir)/$(target)-g++ $(bindir)/$(target)-c++; \
+ fi ; \
else \
rm -f $(bindir)/gcc; \
$(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
chmod a-x $(libsubdir)/SYSCALLS.c.X; \
fi
-if [ -f cc1plus ] ; then \
- rm -f $(bindir)/c++ ; \
- $(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++ ; \
- rm -f $(bindir)/g++ ; \
- $(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++ ; \
+ rm -f $(bindir)/g++; \
+ $(INSTALL_PROGRAM) g++ $(bindir)/g++; \
+ chmod a+x $(bindir)/g++; \
+ rm -f $(bindir)/c++; \
+ ln $(bindir)/g++ $(bindir)/c++; \
fi
-rm -f $(libsubdir)/cpp
$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
# Compare the object files in the current directory with those in the
# stage2 directory.
+# ./ avoids bug in some versions of tail.
compare: force
for file in *.o; do \
- tail +16c $$file > tmp-foo1; \
+ tail +16c ./$$file > tmp-foo1; \
tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
&& (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
done