* srconv.c (wr_hd): Set afl field to 4 for bfd_arch_sh.
[binutils-gdb.git] / cfg-ml-pos.in
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
9 if [ "${enable_multilib}" = yes ]; then
10
11 if [ -z "${with_multisubdir}" ]; then
12 multisubdir=
13 else
14 multisubdir="/${with_multisubdir}"
15 dotdot=`echo ${multisubdir} | sed -e 's:/[^/]*:../:g'`
16 # TOP is used by newlib and should not be used elsewhere for this purpose.
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}
22 fi
23
24 # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
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.
32 #
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).
39
40 sed -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
45 rm -f ${Makefile}
46 mv Makefile.tem ${Makefile}
47
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
51 cat > Multi.tem <<\EOF
52
53 # FIXME: There should be an @-sign in front of the `if'.
54 # Leave out until this is tested a bit more.
55 multi-do:
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}" \
74 $(DO)); then \
75 true; \
76 else \
77 exit 1; \
78 fi; \
79 else true; \
80 fi; \
81 fi; \
82 done; \
83 fi
84
85 # FIXME: There should be an @-sign in front of the `if'.
86 # Leave out until this is tested a bit more.
87 multi-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
101 EOF
102
103 cat ${Makefile} Multi.tem > Makefile.tem
104 rm -f ${Makefile} Multi.tem
105 mv Makefile.tem ${Makefile}
106
107 fi # "${enable_multilib}" = yes