1995-07-21 19:42:32 +02:00
|
|
|
# Configure fragment invoked in the post-target section for subdirs
|
|
|
|
# wanting multilib support.
|
|
|
|
# The intent is to keep as much of this in one place as possible (and out
|
|
|
|
# of each subdirectory, eg: newlib, libio, etc.) until the right way to do
|
|
|
|
# this (ha ha) is decided upon.
|
|
|
|
|
|
|
|
# Only do this if --enable-multilib.
|
|
|
|
|
|
|
|
if [ "${enable_multilib}" = yes ]; then
|
|
|
|
|
|
|
|
if [ -z "${with_multisubdir}" ]; then
|
|
|
|
multisubdir=
|
|
|
|
else
|
|
|
|
multisubdir="/${with_multisubdir}"
|
1995-07-27 23:37:26 +02:00
|
|
|
# The '[^/][^/]*' appears that way to work around a SunOS sed bug.
|
1995-07-27 23:36:29 +02:00
|
|
|
dotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
|
1995-07-22 01:31:44 +02:00
|
|
|
# TOP is used by newlib and should not be used elsewhere for this purpose.
|
1995-07-26 06:31:28 +02:00
|
|
|
# MULTITOP is the proper one to use.
|
|
|
|
# FIXME: newlib needs to be updated to use MULTITOP so we can delete TOP.
|
|
|
|
# Newlib may wish to continue to use TOP for its own purposes of course.
|
|
|
|
sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${dotdot}/\1:" \
|
|
|
|
-e "s:^MULTITOP[ ]*=.*$:MULTITOP = ${dotdot}:" \
|
1995-07-21 19:42:32 +02:00
|
|
|
${Makefile} > Makefile.tem
|
|
|
|
rm -f ${Makefile}
|
|
|
|
mv Makefile.tem ${Makefile}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
|
1995-07-22 01:31:44 +02:00
|
|
|
# and lists the subdirectories to recurse into.
|
|
|
|
# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
|
|
|
|
# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
|
1995-07-26 06:31:28 +02:00
|
|
|
# a leading '/'.
|
1995-07-22 01:31:44 +02:00
|
|
|
# MULTIDO is used for targets like all, install, and check where
|
|
|
|
# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
|
|
|
|
# MULTICLEAN is used for the *clean targets.
|
1995-07-21 21:03:53 +02:00
|
|
|
#
|
1995-07-22 01:31:44 +02:00
|
|
|
# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
|
|
|
|
# currently kept separate because we don't want the *clean targets to require
|
|
|
|
# the existence of the compiler (which MULTIDO currently requires) and
|
|
|
|
# therefore we'd have to record the directory options as well as names
|
|
|
|
# (currently we just record the names and use --print-multi-lib to get the
|
|
|
|
# options).
|
1995-07-21 19:42:32 +02:00
|
|
|
|
1995-07-22 01:31:44 +02:00
|
|
|
sed -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
|
|
|
|
-e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${multisubdir}:" \
|
|
|
|
-e 's:^MULTIDO[ ]*=.*$:MULTIDO = $(MAKE):' \
|
|
|
|
-e 's:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $(MAKE):' \
|
|
|
|
${Makefile} > Makefile.tem
|
|
|
|
rm -f ${Makefile}
|
|
|
|
mv Makefile.tem ${Makefile}
|
1995-07-21 19:42:32 +02:00
|
|
|
|
1995-07-24 19:35:35 +02:00
|
|
|
# ??? May wish to add a check to avoid appending this to Makefiles that
|
|
|
|
# don't need it. It's not necessary, but is cleaner.
|
|
|
|
|
1995-07-22 01:31:44 +02:00
|
|
|
cat > Multi.tem <<\EOF
|
1995-07-21 19:42:32 +02:00
|
|
|
|
1995-07-22 03:27:06 +02:00
|
|
|
# FIXME: There should be an @-sign in front of the `if'.
|
|
|
|
# Leave out until this is tested a bit more.
|
1995-07-22 01:31:44 +02:00
|
|
|
multi-do:
|
1995-07-21 19:42:32 +02:00
|
|
|
if [ -z "$(MULTIDIRS)" ]; then \
|
|
|
|
true; \
|
|
|
|
else \
|
|
|
|
rootpre=`pwd`/; export rootpre; \
|
|
|
|
srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
|
|
|
|
compiler="$(CC)"; \
|
|
|
|
for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
|
|
|
|
dir=`echo $$i | sed -e 's/;.*$$//'`; \
|
|
|
|
if [ "$${dir}" = "." ]; then \
|
|
|
|
true; \
|
|
|
|
else \
|
|
|
|
if [ -d $${dir} ]; then \
|
|
|
|
flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
|
|
|
|
if (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) \
|
|
|
|
CFLAGS="$(CFLAGS) $${flags}" \
|
|
|
|
CXXFLAGS="$(CXXFLAGS) $${flags}" \
|
|
|
|
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
|
|
|
|
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
|
1995-07-22 01:31:44 +02:00
|
|
|
$(DO)); then \
|
1995-07-21 19:42:32 +02:00
|
|
|
true; \
|
|
|
|
else \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
else true; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi
|
|
|
|
|
1995-07-22 03:27:06 +02:00
|
|
|
# FIXME: There should be an @-sign in front of the `if'.
|
|
|
|
# Leave out until this is tested a bit more.
|
1995-07-22 01:31:44 +02:00
|
|
|
multi-clean:
|
|
|
|
if [ -z "$(MULTIDIRS)" ]; then \
|
|
|
|
true; \
|
|
|
|
else \
|
|
|
|
for dir in Makefile $(MULTIDIRS); do \
|
|
|
|
if [ -f ./$$dir/Makefile ]; then \
|
|
|
|
if (cd ./$$dir; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
|
|
|
|
then true; \
|
|
|
|
else exit 1; \
|
|
|
|
fi; \
|
|
|
|
else true; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
fi
|
1995-07-21 19:42:32 +02:00
|
|
|
EOF
|
|
|
|
|
1995-07-22 01:31:44 +02:00
|
|
|
cat ${Makefile} Multi.tem > Makefile.tem
|
|
|
|
rm -f ${Makefile} Multi.tem
|
|
|
|
mv Makefile.tem ${Makefile}
|
1995-07-21 19:42:32 +02:00
|
|
|
|
|
|
|
fi # "${enable_multilib}" = yes
|