aboutsummaryrefslogtreecommitdiff
path: root/cfg-ml-pos.in
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1995-07-21 23:31:44 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1995-07-21 23:31:44 +0000
commit549b77a94579c47f10e0f78c8206c11011ee8d66 (patch)
treeb3951755b3a3344ee8ff001a91d4131d2bf60c2e /cfg-ml-pos.in
parente1d74f116a235314f50169a63f8eef52d4333216 (diff)
downloadgdb-549b77a94579c47f10e0f78c8206c11011ee8d66.zip
gdb-549b77a94579c47f10e0f78c8206c11011ee8d66.tar.gz
gdb-549b77a94579c47f10e0f78c8206c11011ee8d66.tar.bz2
Rewrite so Makefiles do not reference undefined variables.
Diffstat (limited to 'cfg-ml-pos.in')
-rw-r--r--cfg-ml-pos.in101
1 files changed, 41 insertions, 60 deletions
diff --git a/cfg-ml-pos.in b/cfg-ml-pos.in
index 232ca24..9955313 100644
--- a/cfg-ml-pos.in
+++ b/cfg-ml-pos.in
@@ -12,8 +12,8 @@ if [ -z "${with_multisubdir}" ]; then
multisubdir=
else
multisubdir="/${with_multisubdir}"
- # FIXME: following line needs testing in multilevel dir (eg: m68k).
dotdot=`echo ${multisubdir} | sed -e 's:/[^/]*:../:g'`
+ # TOP is used by newlib and should not be used elsewhere for this purpose.
sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${dotdot}\1:" \
-e "s:^MULTITOP[ ]*=[ ]*\([./]*\)[ ]*$:MULTITOP = ${dotdot}\1:" \
${Makefile} > Makefile.tem
@@ -22,47 +22,32 @@ else
fi
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
-# 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 a trailing '/'.
-# XXX_MULTI is a set of helpers for all, install, etc.
-# Makefile.in is free to override them since these are prepended to the top.
-
-cat > Multi.tem <<EOF
-MULTIDIRS = ${multidirs}
-MULTISUBDIR = ${multisubdir}
-EOF
-cat Multi.tem ${Makefile} > Makefile.tem
-rm -f Multi.tem ${Makefile}
-mv Makefile.tem ${Makefile}
-
-# Add default definitions for all, install, clean, etc.
-# if the Makefile uses them.
+# 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
+# a trailing '/'.
+# 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.
#
-# ??? The variables will be undefined when they're not used
-# (eg: native libiberty) and things will work just fine, but some may argue
-# that's not clean. We can always revisit this as necessary (probably by
-# defining all the relevant vars as empty and then instead of prepending
-# corrected values we can modify them in place).
-
-if grep ALL_MULTI ${Makefile} >/dev/null 2>/dev/null
-then
- cat > Multi.tem <<EOF
-ALL_MULTI = all-multi
-INSTALL_MULTI = install-multi
-MOSTLYCLEAN_MULTI = mostlyclean-multi
-CLEAN_MULTI = clean-multi
-DISTCLEAN_MULTI = distclean-multi
-EOF
+# ??? 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).
- cat Multi.tem ${Makefile} > Makefile.tem
- rm -f Multi.tem ${Makefile}
- mv Makefile.tem ${Makefile}
+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}
- cat > Multi.tem <<\EOF
+cat > Multi.tem <<\EOF
-# FIXME: We use --print-multi-lib but the others don't. Standardize.
-all-multi:
+multi-do:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
@@ -81,7 +66,7 @@ all-multi:
CXXFLAGS="$(CXXFLAGS) $${flags}" \
LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
- all); then \
+ $(DO)); then \
true; \
else \
exit 1; \
@@ -92,28 +77,24 @@ all-multi:
done; \
fi
-install-multi mostlyclean-multi clean-multi distclean-multi realclean-multi:
- if [ -n "$(MULTIDIRS)" ]; then \
- rootpre=`pwd`/; export rootpre; \
- srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
- $(MAKE) DO=`echo $@ | sed -e 's/-multi$$//'` DODIRS="$(MULTIDIRS)" $(FLAGS_TO_PASS) multi_subdir_do; \
- else true; fi
-
-multi_subdir_do:
- for i in $(DODIRS); do \
- if [ -f ./$$i/Makefile ] ; then \
- if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)) ; \
- then true ; \
- else exit 1 ; \
- fi ; \
- else true; \
- fi ; \
- done
+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
EOF
- cat ${Makefile} Multi.tem > Makefile.tem
- rm -f ${Makefile} Multi.tem
- mv Makefile.tem ${Makefile}
-fi
+cat ${Makefile} Multi.tem > Makefile.tem
+rm -f ${Makefile} Multi.tem
+mv Makefile.tem ${Makefile}
fi # "${enable_multilib}" = yes