]> Git Repo - binutils.git/blame - cfg-ml-pos.in
* config.guess (*:Linux:*:*): First try asking the linker what the
[binutils.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}"
649d8fdf 15 dotdot=`echo ${with_multisubdir} | sed -e 's:[^/]*:..:g'`
549b77a9 16 # TOP is used by newlib and should not be used elsewhere for this purpose.
649d8fdf
DE
17 # MULTITOP is the proper one to use.
18 # FIXME: newlib needs to be updated to use MULTITOP so we can delete TOP.
19 # Newlib may wish to continue to use TOP for its own purposes of course.
20 sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${dotdot}/\1:" \
21 -e "s:^MULTITOP[ ]*=.*$:MULTITOP = ${dotdot}:" \
9eb59e0b
DE
22 ${Makefile} > Makefile.tem
23 rm -f ${Makefile}
24 mv Makefile.tem ${Makefile}
25fi
26
27# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
549b77a9
DE
28# and lists the subdirectories to recurse into.
29# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
30# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
649d8fdf 31# a leading '/'.
549b77a9
DE
32# MULTIDO is used for targets like all, install, and check where
33# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
34# MULTICLEAN is used for the *clean targets.
55b07f57 35#
549b77a9
DE
36# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are
37# currently kept separate because we don't want the *clean targets to require
38# the existence of the compiler (which MULTIDO currently requires) and
39# therefore we'd have to record the directory options as well as names
40# (currently we just record the names and use --print-multi-lib to get the
41# options).
9eb59e0b 42
549b77a9
DE
43sed -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \
44 -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${multisubdir}:" \
45 -e 's:^MULTIDO[ ]*=.*$:MULTIDO = $(MAKE):' \
46 -e 's:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $(MAKE):' \
47 ${Makefile} > Makefile.tem
48rm -f ${Makefile}
49mv Makefile.tem ${Makefile}
9eb59e0b 50
eae0538f
DE
51# ??? May wish to add a check to avoid appending this to Makefiles that
52# don't need it. It's not necessary, but is cleaner.
53
549b77a9 54cat > Multi.tem <<\EOF
9eb59e0b 55
dfed6a85
DE
56# FIXME: There should be an @-sign in front of the `if'.
57# Leave out until this is tested a bit more.
549b77a9 58multi-do:
9eb59e0b
DE
59 if [ -z "$(MULTIDIRS)" ]; then \
60 true; \
61 else \
62 rootpre=`pwd`/; export rootpre; \
63 srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \
64 compiler="$(CC)"; \
65 for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
66 dir=`echo $$i | sed -e 's/;.*$$//'`; \
67 if [ "$${dir}" = "." ]; then \
68 true; \
69 else \
70 if [ -d $${dir} ]; then \
71 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
72 if (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) \
73 CFLAGS="$(CFLAGS) $${flags}" \
74 CXXFLAGS="$(CXXFLAGS) $${flags}" \
75 LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
76 LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
549b77a9 77 $(DO)); then \
9eb59e0b
DE
78 true; \
79 else \
80 exit 1; \
81 fi; \
82 else true; \
83 fi; \
84 fi; \
85 done; \
86 fi
87
dfed6a85
DE
88# FIXME: There should be an @-sign in front of the `if'.
89# Leave out until this is tested a bit more.
549b77a9
DE
90multi-clean:
91 if [ -z "$(MULTIDIRS)" ]; then \
92 true; \
93 else \
94 for dir in Makefile $(MULTIDIRS); do \
95 if [ -f ./$$dir/Makefile ]; then \
96 if (cd ./$$dir; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
97 then true; \
98 else exit 1; \
99 fi; \
100 else true; \
101 fi; \
102 done; \
103 fi
9eb59e0b
DE
104EOF
105
549b77a9
DE
106cat ${Makefile} Multi.tem > Makefile.tem
107rm -f ${Makefile} Multi.tem
108mv Makefile.tem ${Makefile}
9eb59e0b
DE
109
110fi # "${enable_multilib}" = yes
This page took 0.041931 seconds and 4 git commands to generate.