libc/libgloss/multi-build.in
Tamar Christina 111b6813fb Fix multido compilation on ARM
The previous multi-build implementation was copying the config.status from the parent
multilib directory when building the different semihosting variants. It did so because
the configuration doesn't change. However when you use a relative path to configure it
turns out that the paths inside the config.status are also relative.

To fix this, the srcdir is adjusted from the initial configuration instead of copying it.

Tested on aarch64-none-elf and arm-none-eabi.

Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2017-10-09 19:03:52 +02:00

62 lines
2 KiB
Plaintext

PWD_COMMAND=$${PWDCMD-pwd}
# FIXME: There should be an @-sign in front of the `if'.
# Leave out until this is tested a bit more.
multi-do:
if [ -z "$(MULTIDIRS)" ]; then \
true; \
else \
rootpre=`${PWD_COMMAND}`/; export rootpre; \
srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; export lib; \
compiler="$(CC)"; \
for dir in $(MULTIDIRS); do \
if [ "$${dir}" = "." ]; then \
true; \
else \
destpre=`echo $${rootpre}/$${dir}`/; export destpre; \
if ! test -d $${destpre} ; then \
mkdir -p $${destpre}; \
cd $${destpre}; \
config_cmd=`../config.status --config | sed -re "s:--srcdir=([^/]):--srcdir=../\1:"`; \
$(SHELL) -c "$(SHELL) $${srcrootpre}/configure $${config_cmd}";\
sed -e "s:^MULTIDIRS[[:space:]]*+=.*$$:MULTIDIRS = :" \
-e "s:^MULTILIBNAME[[:space:]]*=.*$$:MULTILIBNAME = MULTIDIR_$${dir}_NAME:" \
-e "s:^MULTI_FLAGS_FOR_TARGET[[:space:]]*=.*$$:MULTI_FLAGS_FOR_TARGET = MULTIDIR_$${dir}_FLAGS:" \
-e "s:^objdir[[:space:]]*=.*$$:objdir = ..:" \
Makefile > Makefile.tem; \
rm -f Makefile; \
mv Makefile.tem Makefile; \
else \
cd $${destpre}; \
fi; \
if ($(MAKE) $(FLAGS_TO_PASS) \
CFLAGS="$(CFLAGS)" \
CCASFLAGS="$(CCASFLAGS)" \
FCFLAGS="$(FCFLAGS)" \
FFLAGS="$(FFLAGS)" \
ADAFLAGS="$(ADAFLAGS)" \
prefix="$(prefix)" \
exec_prefix="$(exec_prefix)" \
GCJFLAGS="$(GCJFLAGS)" \
GOCFLAGS="$(GOCFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LIBCFLAGS="$(LIBCFLAGS)" \
LIBCXXFLAGS="$(LIBCXXFLAGS)" \
LDFLAGS="$(LDFLAGS)" \
MULTIFLAGS="" \
DESTDIR="$(DESTDIR)" \
SOURCE="${srcdir}/" \
INSTALL="$(INSTALL)" \
INSTALL_DATA="$(INSTALL_DATA)" \
INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
$(DO)); then \
cd $${rootpre}; \
else \
exit 1; \
fi; \
fi; \
done; \
fi