* srconv.c (wr_hd): Set afl field to 4 for bfd_arch_sh.
[deliverable/binutils-gdb.git] / cfg-ml-pos.in
CommitLineData
9eb59e0b
DE
1# Configure fragment invoked in the post-target section for subdirs
2# wanting multilib support.
3# The intent is to keep as much of this in one place as possible (and out
4# of each subdirectory, eg: newlib, libio, etc.) until the right way to do
5# this (ha ha) is decided upon.
6
7# Only do this if --enable-multilib.
8
9if [ "${enable_multilib}" = yes ]; then
10
11if [ -z "${with_multisubdir}" ]; then
12 multisubdir=
13else
14 multisubdir="/${with_multisubdir}"
9eb59e0b 15 dotdot=`echo ${multisubdir} | sed -e 's:/[^/]*:../:g'`
549b77a9 16 # TOP is used by newlib and should not be used elsewhere for this purpose.
9eb59e0b
DE
17 sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${dotdot}\1:" \
18 -e "s:^MULTITOP[ ]*=[ ]*\([./]*\)[ ]*$:MULTITOP = ${dotdot}\1:" \
19 ${Makefile} > Makefile.tem
20 rm -f ${Makefile}
21 mv Makefile.tem ${Makefile}
22fi
23
24# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
549b77a9
DE
25# and lists the subdirectories to recurse into.
26# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
27# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
28# a trailing '/'.
29# MULTIDO is used for targets like all, install, and check where
30# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
31# MULTICLEAN is used for the *clean targets.
55b07f57 32#
549b77a9
DE
33# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
34# currently kept separate because we don't want the *clean targets to require
35# the existence of the compiler (which MULTIDO currently requires) and
36# therefore we'd have to record the directory options as well as names
37# (currently we just record the names and use --print-multi-lib to get the
38# options).
9eb59e0b 39
549b77a9
DE
40sed -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
41 -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${multisubdir}:" \
42 -e 's:^MULTIDO[ ]*=.*$:MULTIDO = $(MAKE):' \
43 -e 's:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $(MAKE):' \
44 ${Makefile} > Makefile.tem
45rm -f ${Makefile}
46mv Makefile.tem ${Makefile}
9eb59e0b 47
eae0538f
DE
48# ??? May wish to add a check to avoid appending this to Makefiles that
49# don't need it. It's not necessary, but is cleaner.
50
549b77a9 51cat > Multi.tem <<\EOF
9eb59e0b 52
dfed6a85
DE
53# FIXME: There should be an @-sign in front of the `if'.
54# Leave out until this is tested a bit more.
549b77a9 55multi-do:
9eb59e0b
DE
56 if [ -z "$(MULTIDIRS)" ]; then \
57 true; \
58 else \
59 rootpre=`pwd`/; export rootpre; \
60 srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
61 compiler="$(CC)"; \
62 for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
63 dir=`echo $$i | sed -e 's/;.*$$//'`; \
64 if [ "$${dir}" = "." ]; then \
65 true; \
66 else \
67 if [ -d $${dir} ]; then \
68 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
69 if (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) \
70 CFLAGS="$(CFLAGS) $${flags}" \
71 CXXFLAGS="$(CXXFLAGS) $${flags}" \
72 LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
73 LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
549b77a9 74 $(DO)); then \
9eb59e0b
DE
75 true; \
76 else \
77 exit 1; \
78 fi; \
79 else true; \
80 fi; \
81 fi; \
82 done; \
83 fi
84
dfed6a85
DE
85# FIXME: There should be an @-sign in front of the `if'.
86# Leave out until this is tested a bit more.
549b77a9
DE
87multi-clean:
88 if [ -z "$(MULTIDIRS)" ]; then \
89 true; \
90 else \
91 for dir in Makefile $(MULTIDIRS); do \
92 if [ -f ./$$dir/Makefile ]; then \
93 if (cd ./$$dir; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
94 then true; \
95 else exit 1; \
96 fi; \
97 else true; \
98 fi; \
99 done; \
100 fi
9eb59e0b
DE
101EOF
102
549b77a9
DE
103cat ${Makefile} Multi.tem > Makefile.tem
104rm -f ${Makefile} Multi.tem
105mv Makefile.tem ${Makefile}
9eb59e0b
DE
106
107fi # "${enable_multilib}" = yes
This page took 0.026666 seconds and 4 git commands to generate.