public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] libgloss: convert a few more arches to automake
@ 2022-12-21  1:58 Mike Frysinger
  2022-12-21  1:58 ` [PATCH 1/4] libgloss: merge aarch64 into top-level Makefile Mike Frysinger
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Mike Frysinger @ 2022-12-21  1:58 UTC (permalink / raw)
  To: newlib

This speeds the build up and simplifies the source rules.  It also
gets us to ~20% arch conversion (9/49), so hopefully it will make
it easier for new ports to use (more examples), and encourage some
existing ones to convert.

Mostly I wanted to burn down aarch64 & arm, but I did arc & d30v
too since they were small & easy.

Verified that `make install` produces the same set of files with
the same contents (at the disassembly level).

Mike Frysinger (4):
  libgloss: merge aarch64 into top-level Makefile
  libgloss: merge arm into top-level Makefile
  libgloss: merge arc into top-level Makefile
  libgloss: merge d30v into top-level Makefile

 libgloss/Makefile.am                   |  13 +
 libgloss/Makefile.in                   | 869 ++++++++++++++++++++++---
 libgloss/aarch64/Makefile.in           | 166 -----
 libgloss/aarch64/Makefile.inc          |  34 +
 libgloss/aarch64/cpu-init/Makefile.in  | 107 ---
 libgloss/aarch64/cpu-init/Makefile.inc |  20 +
 libgloss/arc/Makefile.in               | 122 ----
 libgloss/arc/Makefile.inc              |  12 +
 libgloss/arm/Makefile.in               | 241 -------
 libgloss/arm/Makefile.inc              |  89 +++
 libgloss/arm/acinclude.m4              |  10 -
 libgloss/arm/cpu-init/Makefile.in      |  84 ---
 libgloss/arm/cpu-init/Makefile.inc     |  15 +
 libgloss/configure                     | 105 ++-
 libgloss/configure.ac                  |  16 +-
 libgloss/d30v/Makefile.in              | 129 ----
 libgloss/d30v/Makefile.inc             |  12 +
 17 files changed, 1066 insertions(+), 978 deletions(-)
 delete mode 100644 libgloss/aarch64/Makefile.in
 create mode 100644 libgloss/aarch64/Makefile.inc
 delete mode 100644 libgloss/aarch64/cpu-init/Makefile.in
 create mode 100644 libgloss/aarch64/cpu-init/Makefile.inc
 delete mode 100644 libgloss/arc/Makefile.in
 create mode 100644 libgloss/arc/Makefile.inc
 delete mode 100644 libgloss/arm/Makefile.in
 create mode 100644 libgloss/arm/Makefile.inc
 delete mode 100644 libgloss/arm/cpu-init/Makefile.in
 create mode 100644 libgloss/arm/cpu-init/Makefile.inc
 delete mode 100644 libgloss/d30v/Makefile.in
 create mode 100644 libgloss/d30v/Makefile.inc

-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] libgloss: merge aarch64 into top-level Makefile
  2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
@ 2022-12-21  1:58 ` Mike Frysinger
  2022-12-21  1:58 ` [PATCH 2/4] libgloss: merge arm " Mike Frysinger
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2022-12-21  1:58 UTC (permalink / raw)
  To: newlib

Avoid a recursive make to speed things up a bit.
---
 libgloss/Makefile.am                   |   4 +
 libgloss/Makefile.in                   | 333 ++++++++++++++++++++-----
 libgloss/aarch64/Makefile.in           | 166 ------------
 libgloss/aarch64/Makefile.inc          |  34 +++
 libgloss/aarch64/cpu-init/Makefile.in  | 107 --------
 libgloss/aarch64/cpu-init/Makefile.inc |  20 ++
 libgloss/configure                     |  20 +-
 libgloss/configure.ac                  |   5 +-
 8 files changed, 342 insertions(+), 347 deletions(-)
 delete mode 100644 libgloss/aarch64/Makefile.in
 create mode 100644 libgloss/aarch64/Makefile.inc
 delete mode 100644 libgloss/aarch64/cpu-init/Makefile.in
 create mode 100644 libgloss/aarch64/cpu-init/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 5464eb8bdb81..5b5f0fd541ae 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -6,6 +6,7 @@ ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 bin_PROGRAMS =
 check_PROGRAMS =
 info_TEXINFOS =
+CLEANFILES =
 PHONY =
 
 SUBDIRS = @subdirs@ .
@@ -59,6 +60,9 @@ TEXINFO_TEX = ../texinfo/texinfo.tex
 if HAVE_DOC
 include doc/Makefile.inc
 endif
+if CONFIG_AARCH64
+include aarch64/Makefile.inc
+endif
 if CONFIG_BFIN
 include bfin/Makefile.inc
 endif
diff --git a/libgloss/aarch64/Makefile.in b/libgloss/aarch64/Makefile.in
deleted file mode 100644
index 980c75858da3..000000000000
--- a/libgloss/aarch64/Makefile.in
+++ /dev/null
@@ -1,166 +0,0 @@
-#  Copyright (c) 2012 ARM Ltd.  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. The name of the company may not be used to endorse or promote
-#     products derived from this software without specific prior written
-#     permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
-#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-#  IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/..
-srcdir = @srcdir@
-abs_srcdir = @abs_srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-objtype = @AARCH64_OBJTYPE@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-SHELL =	/bin/sh
-
-mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
-	then echo ${objroot}/../binutils/objdump ; \
-	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
-OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
-	then echo ${objroot}/../binutils/objcopy ; \
-	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-
-OBJS = ftruncate.o libcfunc.o syscalls.o truncate.o _exit.o _kill.o
-CRT0		= crt0.o
-CRT0_INSTALL	= install-crt0
-
-RDIMON_CRT0	= rdimon-crt0.o
-RDIMON_BSP	= librdimon.a
-RDIMON_OBJS	= $(patsubst %,rdimon-%,$(OBJS))
-RDIMON_SCRIPTS	= rdimon.specs \
-		  aem-ve.specs \
-		  aem-validation.specs \
-		  aem-v8-r.specs
-RDIMON_INSTALL	= install-rdimon
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-#
-# build a test program for each target board. Just trying to get
-# it to link is a good test, so we ignore all the errors for now.
-#
-
-all: ${CRT0} ${RDIMON_CRT0} ${RDIMON_BSP} ${RDIMON_SCRIPTS}
-
-#
-# here's where we build the test programs for each target
-#
-.PHONY: test
-test:
-
-#
-crt0.o: crt0.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -o $@ -c $<
-
-rdimon-crt0.o: crt0.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-#rdimon-trap.o: trap.S
-#	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_exit.o: _exit.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-ftruncate.o: ftruncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_kill.o: _kill.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-libcfunc.o: libcfunc.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-syscalls.o: syscalls.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-truncate.o: truncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-$(RDIMON_BSP): $(RDIMON_OBJS)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-clean mostlyclean:
-	rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) ${RDIMON_SCRIPTS}
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info
-install: ${CRT0_INSTALL} ${RDIMON_INSTALL}
-
-install-crt0:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x
-
-install-rdimon:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${RDIMON_CRT0} ${RDIMON_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-	set -e; for x in ${RDIMON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-# Make copies of the scripts to facilitate in-tree bootstrapping.
-${RDIMON_SCRIPTS}: %: ${objtype}%
-	cp $< $@
-
-doc:
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/aarch64/Makefile.inc b/libgloss/aarch64/Makefile.inc
new file mode 100644
index 000000000000..b9c8d983366b
--- /dev/null
+++ b/libgloss/aarch64/Makefile.inc
@@ -0,0 +1,34 @@
+multilibtool_LIBRARIES += %D%/librdimon.a
+%C%_librdimon_a_SOURCES = \
+	%D%/_exit.c \
+	%D%/_kill.c \
+	%D%/ftruncate.c \
+	%D%/libcfunc.c \
+	%D%/syscalls.c \
+	%D%/truncate.c
+%C%_librdimon_a_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-DSEMIHOST_V2 -DARM_RDI_MONITOR
+
+%C%_SPECS = \
+	%D%/aem-v8-r.specs \
+	%D%/aem-validation.specs \
+	%D%/aem-ve.specs \
+	%D%/rdimon.specs
+multilibtool_DATA += \
+	%D%/crt0.o \
+	%D%/rdimon-crt0.o \
+	$(%C%_SPECS)
+
+%D%/crt0.$(OBJEXT): %D%/crt0.S
+	$(AM_V_CPPAS)$(CPPASCOMPILE) -DSEMIHOST_V2 -o $@ -c $<
+%D%/rdimon-crt0.$(OBJEXT): %D%/crt0.S
+	$(AM_V_CPPAS)$(CPPASCOMPILE) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
+
+## Make copies of the scripts to facilitate in-tree bootstrapping.
+%D%/%.specs: %D%/$(AARCH64_OBJTYPE)%.specs
+	$(AM_V_GEN)cp $< $@
+
+CLEANFILES += $(%C%_SPECS)
+
+include %D%/cpu-init/Makefile.inc
diff --git a/libgloss/aarch64/cpu-init/Makefile.in b/libgloss/aarch64/cpu-init/Makefile.in
deleted file mode 100644
index 4aef917ebe5a..000000000000
--- a/libgloss/aarch64/cpu-init/Makefile.in
+++ /dev/null
@@ -1,107 +0,0 @@
-#  Copyright (c) 2012 ARM Ltd.  All rights reserved.
-#
-#  Redistribution and use in source and binary forms, with or without
-#  modification, are permitted provided that the following conditions
-#  are met:
-#  1. Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-#  2. Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#  3. The name of the company may not be used to endorse or promote
-#     products derived from this software without specific prior written
-#     permission.
-#
-#  THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
-#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-#  IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-#  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/.. @srcdir@/../..
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../../..
-objroot = $(objdir)/../../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-SHELL =	/bin/sh
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-CPU_INIT_OBJS = rdimon-aem-el3.o rdimon-aem-v8-r.o
-CPU_INIT_INSTALL = install-cpu-init
-
-CFLAGS		= -g
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-.PHONY: all
-all: ${CPU_INIT_OBJS}
-
-#
-# here's where we build the test programs for each target
-#
-.PHONY: test
-test:
-
-rdimon-aem-el3.o : rdimon-aem-el3.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-aem-v8-r.o : rdimon-aem-el3.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -DBUILD_FOR_R_PROFILE -o $@ -c $<
-
-clean mostlyclean:
-	rm -f a.out core *.i *.o *-test *.srec *.dis *.x
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info
-install: ${CPU_INIT_INSTALL}
-
-install-cpu-init:
-	test -d $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init || mkdir $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init
-	set -e; for x in ${CPU_INIT_OBJS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init/$$x; done
-
-doc:
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../../config.status
-	cd ../.. && $(SHELL) ./config.status --file aarch64/cpu-init/Makefile
diff --git a/libgloss/aarch64/cpu-init/Makefile.inc b/libgloss/aarch64/cpu-init/Makefile.inc
new file mode 100644
index 000000000000..031369ee7e13
--- /dev/null
+++ b/libgloss/aarch64/cpu-init/Makefile.inc
@@ -0,0 +1,20 @@
+%C%_CPPFLAGS = -I$(srcdir)/%D%/..
+
+%C%cpuinitdir = $(tooldir)/lib$(MULTISUBDIR)/cpu-init
+%C%cpuinit_DATA = \
+	%D%/rdimon-aem-el3.o \
+	%D%/rdimon-aem-v8-r.o
+
+## The manual dirstamp is needed as automake doesn't recognize compile rules
+## via DATA.  If we ever add rules it does know about, we can drop this.
+%D%/$(am__dirstamp):
+	@$(MKDIR_P) %D%
+	@: > $@
+
+%D%/rdimon-aem-el3.$(OBJEXT): %D%/rdimon-aem-el3.S %D%/$(am__dirstamp)
+	$(AM_V_CC)$(COMPILE) $(%C%_CPPFLAGS) -DARM_RDI_MONITOR -o $@ -c $<
+
+%D%/rdimon-aem-v8-r.$(OBJEXT): %D%/rdimon-aem-el3.S %D%/$(am__dirstamp)
+	$(AM_V_CC)$(COMPILE) $(%C%_CPPFLAGS) -DARM_RDI_MONITOR -DBUILD_FOR_R_PROFILE -o $@ -c $<
+
+CLEANFILES += $(%C%cpuinit_DATA)
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 9906781a722f..33026534ffee 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -46,8 +46,7 @@ target_makefile_frag=${srcdir}/config/default.mt
 
 case "${target}" in
   aarch64*-*-*)
-	AC_CONFIG_FILES([aarch64/Makefile aarch64/cpu-init/Makefile])
-	subdirs="$subdirs aarch64 aarch64/cpu-init"
+	config_aarch64=true
 	config_testsuite=true
 	;;
   arc*-*-*)
@@ -251,7 +250,7 @@ AC_SUBST(subdirs)
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
-  bfin iq2000 libnosys lm32 riscv wince
+  aarch64 bfin iq2000 libnosys lm32 riscv wince
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] libgloss: merge arm into top-level Makefile
  2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
  2022-12-21  1:58 ` [PATCH 1/4] libgloss: merge aarch64 into top-level Makefile Mike Frysinger
@ 2022-12-21  1:58 ` Mike Frysinger
  2022-12-21  1:58 ` [PATCH 3/4] libgloss: merge arc " Mike Frysinger
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2022-12-21  1:58 UTC (permalink / raw)
  To: newlib

Avoid a recursive make to speed things up a bit.
---
 libgloss/Makefile.am               |   3 +
 libgloss/Makefile.in               | 556 +++++++++++++++++++++++++----
 libgloss/arm/Makefile.in           | 241 -------------
 libgloss/arm/Makefile.inc          |  89 +++++
 libgloss/arm/acinclude.m4          |  10 -
 libgloss/arm/cpu-init/Makefile.in  |  84 -----
 libgloss/arm/cpu-init/Makefile.inc |  15 +
 libgloss/configure                 |  47 ++-
 libgloss/configure.ac              |   7 +-
 9 files changed, 627 insertions(+), 425 deletions(-)
 delete mode 100644 libgloss/arm/Makefile.in
 create mode 100644 libgloss/arm/Makefile.inc
 delete mode 100644 libgloss/arm/cpu-init/Makefile.in
 create mode 100644 libgloss/arm/cpu-init/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 5b5f0fd541ae..9fed4655a422 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -63,6 +63,9 @@ endif
 if CONFIG_AARCH64
 include aarch64/Makefile.inc
 endif
+if CONFIG_ARM
+include arm/Makefile.inc
+endif
 if CONFIG_BFIN
 include bfin/Makefile.inc
 endif
diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in
deleted file mode 100644
index d0d5ea89d62e..000000000000
--- a/libgloss/arm/Makefile.in
+++ /dev/null
@@ -1,241 +0,0 @@
-#
-#
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/..
-srcdir = @srcdir@
-abs_srcdir = @abs_srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-objtype = @ARM_OBJTYPE@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-SHELL =	/bin/sh
-
-mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
-	then echo ${objroot}/../binutils/objdump ; \
-	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
-OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
-	then echo ${objroot}/../binutils/objcopy ; \
-	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-
-@ARM_BUILD_CRT0_TRUE@CRT0		= crt0.o
-@ARM_BUILD_CRT0_TRUE@CRT0_INSTALL	= install-crt0
-@ARM_BUILD_CRT0_FALSE@CRT0		=
-@ARM_BUILD_CRT0_FALSE@CRT0_INSTALL	=
-
-NANO_SCRIPTS=nano.specs
-NANO_INSTALL=install-nano
-
-LINUX_CRT0    = linux-crt0.o
-LINUX_BSP     = libgloss-linux.a
-LINUX_OBJS    = linux-syscalls0.o linux-syscalls1.o
-LINUX_SCRIPTS = linux.specs
-LINUX_INSTALL = install-linux
-
-REDBOOT_CRT0	= redboot-crt0.o 
-REDBOOT_OBJS	= redboot-syscalls.o
-REDBOOT_SCRIPTS	= redboot.ld redboot.specs
-REDBOOT_INSTALL	= install-redboot
-
-RDPMON_CRT0	= rdpmon-crt0.o
-RDPMON_BSP	= librdpmon.a
-RDPMON_OBJS	= ftruncate.o libcfunc.o syscalls.o trap.o truncate.o _exit.o _kill.o
-RDPMON_SCRIPTS	= rdpmon.specs
-RDPMON_INSTALL	= install-rdpmon
-
-RDIMON_CRT0	= rdimon-crt0.o rdimon-crt0-v2m.o
-RDIMON_BSP	= librdimon.a librdimon-v2m.a
-RDIMON_OBJS	= $(patsubst %,rdimon-%,$(RDPMON_OBJS))
-_RDIMON_SCRIPTS	= rdimon.specs \
-		  aprofile-validation.specs \
-		  aprofile-ve.specs
-RDIMON_SCRIPTS	= $(_RDIMON_SCRIPTS) $(patsubst %.specs,%-v2m.specs,$(_RDIMON_SCRIPTS))
-RDIMON_INSTALL	= install-rdimon
-RDIMON_SEMIHV2M_OBJS = $(patsubst %.o,rdimon-%-v2m.o,$(RDPMON_OBJS))
-
-# Here is all of the eval board stuff
-PID_SCRIPTS	= pid.specs
-PID_INSTALL	= install-pid
-
-IQ80310_SCRIPTS	= iq80310.specs
-IQ80310_INSTALL	= install-iq80310
-
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-#
-# build a test program for each target board. Just trying to get
-# it to link is a good test, so we ignore all the errors for now.
-#
-all: ${CRT0} ${LINUX_CRT0} ${LINUX_BSP} ${REDBOOT_CRT0} ${REDBOOT_OBJS} ${RDPMON_CRT0} ${RDPMON_BSP} ${RDIMON_CRT0} ${RDIMON_BSP}
-
-#
-# here's where we build the test programs for each target
-#
-.PHONY: test
-test:
-
-#
-crt0.o: crt0.S
-redboot-crt0.o: redboot-crt0.S
-redboot-syscalls.o: redboot-syscalls.c $(srcdir)/../syscall.h
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -o $@ -c $<
-
-rdpmon-crt0.o: crt0.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDP_MONITOR -o $@ -c $<
-
-rdimon-crt0.o: crt0.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-ftruncate.o: ftruncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-trap.o: trap.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-truncate.o: truncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_exit.o: _exit.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_kill.o: _kill.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-syscalls.o: syscalls.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-libcfunc.o: libcfunc.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-crt0-v2m.o: crt0.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-ftruncate-v2m.o: ftruncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-trap-v2m.o: trap.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-truncate-v2m.o: truncate.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_exit-v2m.o: _exit.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-_kill-v2m.o: _kill.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-syscalls-v2m.o: syscalls.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-rdimon-libcfunc-v2m.o: libcfunc.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DSEMIHOST_V2 -DSEMIHOST_V2_MIXED_MODE -DARM_RDI_MONITOR -o $@ -c $<
-
-$(LINUX_BSP): $(LINUX_OBJS)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-$(RDPMON_BSP): $(RDPMON_OBJS)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-librdimon.a: $(RDIMON_OBJS)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-librdimon-v2m.a: $(RDIMON_SEMIHV2M_OBJS)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-# Multilib support.
-.PHONY:  libgloss-multi-do all-multi clean-multi install-multi
-
-clean mostlyclean:
-	rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(IQ80310_BSP)
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info
-install: ${CRT0_INSTALL} ${LINUX_INSTALL} ${REDBOOT_INSTALL} ${RDPMON_INSTALL} ${RDIMON_INSTALL} ${IQ80310_INSTALL}  ${PID_INSTALL} ${NANO_INSTALL}
-
-install-nano:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${NANO_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-install-crt0:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x
-
-install-linux:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${LINUX_CRT0} ${LINUX_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-	set -e; for x in ${LINUX_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-install-redboot:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${REDBOOT_CRT0} ${REDBOOT_OBJS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-	set -e; for x in ${REDBOOT_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-install-rdpmon:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${RDPMON_CRT0} ${RDPMON_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-	set -e; for x in ${RDPMON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-install-rdimon:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${RDIMON_CRT0} ${RDIMON_BSP}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-	set -e; for x in ${RDIMON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-
-install-pid:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${PID_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-install-iq80310:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${IQ80310_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-
-doc:
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) ./config.status
diff --git a/libgloss/arm/Makefile.inc b/libgloss/arm/Makefile.inc
new file mode 100644
index 000000000000..41fce3c999c3
--- /dev/null
+++ b/libgloss/arm/Makefile.inc
@@ -0,0 +1,89 @@
+if !MAY_SUPPLY_SYSCALLS
+multilibtool_DATA += %D%/crt0.o
+endif
+
+%C%_SPECS =
+
+## nano files.
+%C%_SPECS += %D%/nano.specs
+
+## Linux files.
+%C%_SPECS += %D%/linux.specs
+multilibtool_DATA += %D%/linux-crt0.o
+multilibtool_LIBRARIES += %D%/libgloss-linux.a
+%C%_libgloss_linux_a_SOURCES = \
+	%D%/linux-syscalls0.c \
+	%D%/linux-syscalls1.c
+
+## RedBoot files.
+%C%_SPECS += %D%/redboot.ld %D%/redboot.specs
+multilibtool_DATA += \
+	%D%/redboot-crt0.o \
+	%D%/redboot-syscalls.o
+
+%D%/redboot-syscalls.o: %D%/redboot-syscalls.c
+	$(AM_V_CC)$(COMPILE) -DSEMIHOST_V2 -o $@ -c $<
+
+## rdpmon files.
+%C%_SPECS += %D%/rdpmon.specs
+multilibtool_DATA += %D%/rdpmon-crt0.o
+multilibtool_LIBRARIES += %D%/librdpmon.a
+%C%_librdpmon_a_SOURCES = \
+	%D%/_exit.c \
+	%D%/_kill.c \
+	%D%/ftruncate.c \
+	%D%/libcfunc.c \
+	%D%/syscalls.c \
+	%D%/trap.S \
+	%D%/truncate.c
+
+%D%/rdpmon-crt0.o: %D%/crt0.S
+	$(AM_V_CPPAS)$(CPPASCOMPILE) -DSEMIHOST_V2 -DARM_RDP_MONITOR -o $@ -c $<
+
+## rdimon files.
+%C%_SPECS += \
+	%D%/rdimon.specs \
+	%D%/rdimon-v2m.specs \
+	%D%/aprofile-validation.specs \
+	%D%/aprofile-validation-v2m.specs \
+	%D%/aprofile-ve-v2m.specs \
+	%D%/aprofile-ve.specs
+multilibtool_DATA += \
+	%D%/rdimon-crt0.o \
+	%D%/rdimon-crt0-v2m.o
+multilibtool_LIBRARIES += \
+	%D%/librdimon.a \
+	%D%/librdimon-v2m.a
+
+%C%_RDIMON_CPPFLAGS = -DSEMIHOST_V2 -DARM_RDI_MONITOR
+%C%_RDIMON_V2M_CPPFLAGS = $(%C%_RDIMON_CPPFLAGS) -DSEMIHOST_V2_MIXED_MODE
+
+%D%/rdimon-crt0.o: %D%/crt0.S
+	$(AM_V_CPPAS)$(CPPASCOMPILE) $(%C%_RDIMON_CPPFLAGS) -o $@ -c $<
+
+%D%/rdimon-crt0-v2m.o: %D%/crt0.S
+	$(AM_V_CPPAS)$(CPPASCOMPILE) $(%C%_RDIMON_V2M_CPPFLAGS) -o $@ -c $<
+
+%C%_librdimon_a_SOURCES = $(%C%_librdpmon_a_SOURCES)
+%C%_librdimon_a_CPPFLAGS = $(AM_CPPFLAGS) $(%C%_RDIMON_CPPFLAGS)
+%C%_librdimon_v2m_a_SOURCES = $(%C%_librdpmon_a_SOURCES)
+%C%_librdimon_v2m_a_CPPFLAGS = $(AM_CPPFLAGS) $(%C%_RDIMON_V2M_CPPFLAGS)
+
+## Here is all of the eval board stuff.
+%C%_SPECS += \
+	%D%/pid.specs \
+	%D%/iq80310.specs
+
+multilibtool_DATA += \
+	$(%C%_SPECS)
+
+## Make copies of the scripts to facilitate in-tree bootstrapping.
+%D%/%.specs: %D%/$(ARM_OBJTYPE)%.specs
+	$(AM_V_GEN)cp $< $@
+
+%D%/%.ld: %D%/$(ARM_OBJTYPE)%.ld
+	$(AM_V_GEN)cp $< $@
+
+CLEANFILES += $(%C%_SPECS)
+
+include %D%/cpu-init/Makefile.inc
diff --git a/libgloss/arm/acinclude.m4 b/libgloss/arm/acinclude.m4
index b34a40f9c61d..d61474d3ade2 100644
--- a/libgloss/arm/acinclude.m4
+++ b/libgloss/arm/acinclude.m4
@@ -1,13 +1,3 @@
-if test "x$newlib_may_supply_syscalls" = "xyes"; then
-  ARM_BUILD_CRT0_TRUE='#'
-  ARM_BUILD_CRT0_FALSE=
-else
-  ARM_BUILD_CRT0_TRUE=
-  ARM_BUILD_CRT0_FALSE='#'
-fi
-AC_SUBST(ARM_BUILD_CRT0_TRUE)
-AC_SUBST(ARM_BUILD_CRT0_FALSE)
-
 ARM_OBJTYPE=
 case "${target}" in
   *-*-elf | *-*-eabi* | *-*-tirtos*)
diff --git a/libgloss/arm/cpu-init/Makefile.in b/libgloss/arm/cpu-init/Makefile.in
deleted file mode 100644
index 49ad53818d08..000000000000
--- a/libgloss/arm/cpu-init/Makefile.in
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-#
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/.. @srcdir@/../..
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../../..
-objroot = $(objdir)/../../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-objtype = @objtype@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-SHELL =	/bin/sh
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-CPU_INIT_OBJS = rdimon-aem.o
-CPU_INIT_INSTALL = install-cpu-init
-
-CFLAGS		= -g
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-.PHONY: all
-all: ${CPU_INIT_OBJS}
-
-#
-# here's where we build the test programs for each target
-#
-.PHONY: test
-test:
-
-# Static pattern rule for assembling cpu init files to object files.
-${CPU_INIT_OBJS}: %.o: %.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $<
-
-clean mostlyclean:
-	rm -f a.out core *.i *.o *-test *.srec *.dis *.x
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info
-install: ${CPU_INIT_INSTALL}
-
-install-cpu-init:
-	test -d $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init || mkdir $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init
-	set -e; for x in ${CPU_INIT_OBJS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/cpu-init/$$x; done
-
-doc:
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../../config.status
-	cd ../.. && $(SHELL) ./config.status --file arm/cpu-init/Makefile
diff --git a/libgloss/arm/cpu-init/Makefile.inc b/libgloss/arm/cpu-init/Makefile.inc
new file mode 100644
index 000000000000..5a8a75657a44
--- /dev/null
+++ b/libgloss/arm/cpu-init/Makefile.inc
@@ -0,0 +1,15 @@
+%C%cpuinitdir = $(tooldir)/lib$(MULTISUBDIR)/cpu-init
+%C%cpuinit_DATA = \
+	%D%/rdimon-aem.o
+
+## The manual dirstamp is needed as automake doesn't recognize compile rules
+## via DATA.  If we ever add rules it does know about, we can drop this.
+%D%/$(am__dirstamp):
+	@$(MKDIR_P) %D%
+	@: > $@
+
+%D%/rdimon-aem.$(OBJEXT): %D%/rdimon-aem.S %D%/$(am__dirstamp)
+	@$(MKDIR_P) %D%
+	$(AM_V_CC)$(COMPILE) -DARM_RDI_MONITOR -o $@ -c $<
+
+CLEANFILES += $(%C%cpuinit_DATA)
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 33026534ffee..6b0117805570 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -18,6 +18,8 @@ AC_ARG_ENABLE(newlib-supplied-syscalls,
   *)   AC_MSG_ERROR(bad value ${enableval} for newlib-supplied-syscalls option) ;;
  esac], [newlib_may_supply_syscalls=yes])dnl
 
+AM_CONDITIONAL(MAY_SUPPLY_SYSCALLS, test x[$]{newlib_may_supply_syscalls} = xyes)
+
 AC_PROG_INSTALL
 
 AC_CANONICAL_SYSTEM
@@ -214,8 +216,7 @@ case "${target}" in
 	subdirs="$subdirs rx"
 	;;
   arm*-*-elf | arm*-*-coff | arm*-*-*)
-	AC_CONFIG_FILES([arm/Makefile arm/cpu-init/Makefile])
-	subdirs="$subdirs arm arm/cpu-init"
+	config_arm=true
 	;;
   spu-*-elf)
 	AC_CONFIG_FILES([spu/Makefile])
@@ -250,7 +251,7 @@ AC_SUBST(subdirs)
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
-  aarch64 bfin iq2000 libnosys lm32 riscv wince
+  aarch64 arm bfin iq2000 libnosys lm32 riscv wince
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] libgloss: merge arc into top-level Makefile
  2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
  2022-12-21  1:58 ` [PATCH 1/4] libgloss: merge aarch64 into top-level Makefile Mike Frysinger
  2022-12-21  1:58 ` [PATCH 2/4] libgloss: merge arm " Mike Frysinger
@ 2022-12-21  1:58 ` Mike Frysinger
  2022-12-21  1:58 ` [PATCH 4/4] libgloss: merge d30v " Mike Frysinger
  2023-01-09 10:51 ` [PATCH 0/4] libgloss: convert a few more arches to automake Corinna Vinschen
  4 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2022-12-21  1:58 UTC (permalink / raw)
  To: newlib

Avoid a recursive make to speed things up a bit.
---
 libgloss/Makefile.am      |   3 +
 libgloss/Makefile.in      | 136 +++++++++++++++++++++++++-------------
 libgloss/arc/Makefile.in  | 122 ----------------------------------
 libgloss/arc/Makefile.inc |  12 ++++
 libgloss/configure        |  19 ++++--
 libgloss/configure.ac     |   5 +-
 6 files changed, 122 insertions(+), 175 deletions(-)
 delete mode 100644 libgloss/arc/Makefile.in
 create mode 100644 libgloss/arc/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 9fed4655a422..f5016dcd4b3e 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -63,6 +63,9 @@ endif
 if CONFIG_AARCH64
 include aarch64/Makefile.inc
 endif
+if CONFIG_ARC
+include arc/Makefile.inc
+endif
 if CONFIG_ARM
 include arm/Makefile.inc
 endif
diff --git a/libgloss/arc/Makefile.in b/libgloss/arc/Makefile.in
deleted file mode 100644
index e343dd222863..000000000000
--- a/libgloss/arc/Makefile.in
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-#
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/..
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-objtype = @objtype@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-SHELL =	/bin/sh
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
-	then echo ${objroot}/../binutils/objdump ; \
-	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
-OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
-	then echo ${objroot}/../binutils/objcopy ; \
-	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-
-CRT0		= gcrt0.o crt0.o
-CRT0_INSTALL	= install-crt0
-
-NSIM_BSP = libnsim.a
-NSIM_OBJS = \
-	libcfunc.o \
-	nsim-syscalls.o \
-	sbrk.o \
-	mcount.o
-NSIM_INSTALL = install-nsim
-NSIM_SCRIPTS = nsim.specs
-
-NANO_SCRIPTS = nano.specs
-NANO_INSTALL = install-nano
-
-CFLAGS		= -g
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-all: $(CRT0) $(NSIM_BSP)
-
-$(NSIM_BSP): $(NSIM_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-libcfunc.o: libcfunc.c
-nsim-syscalls.o: nsim-syscalls.c
-sbrk.o: sbrk.c
-mcount.o: mcount.c
-gcrt0.o: gcrt0.S crt0.S
-crt0.o: crt0.S
-
-clean mostlyclean:
-	rm -f *.o *.a
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info doc dvi
-install: $(CRT0_INSTALL) $(NSIM_INSTALL) $(NANO_INSTALL)
-
-# multilibdir may not exist yet - libgcc for ARC depends on libc, hence
-# newlib/libgloss is built before libgcc. And in parallel build libgloss maybe
-# built and installed before newlib, therefore libgloss has to create target
-# directory.
-
-$(CRT0_INSTALL):
-	$(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
-	for c in $(CRT0); do \
-	  b=`basename $$c`; \
-	  ${INSTALL_DATA} $$c $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$b ;\
-	done
-
-$(NSIM_INSTALL):
-	$(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
-	$(INSTALL_DATA) $(NSIM_BSP) $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$(NSIM_BSP)
-	for x in $(NSIM_SCRIPTS); do \
-	    $(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$$x; done
-
-$(NANO_INSTALL):
-	$(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
-	for x in $(NANO_SCRIPTS); do \
-		$(INSTALL_DATA) $(srcdir)/$$x $(DESTDIR)$(tooldir)/lib$(MULTISUBDIR)/$$x; done
-
-doc:
-info:
-dvi:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/arc/Makefile.inc b/libgloss/arc/Makefile.inc
new file mode 100644
index 000000000000..fe9cc761045d
--- /dev/null
+++ b/libgloss/arc/Makefile.inc
@@ -0,0 +1,12 @@
+multilibtool_LIBRARIES += %D%/libnsim.a
+%C%_libnsim_a_SOURCES = \
+	%D%/libcfunc.c \
+	%D%/mcount.c \
+	%D%/nsim-syscalls.c \
+	%D%/sbrk.c
+
+multilibtool_DATA += \
+	%D%/crt0.o \
+	%D%/gcrt0.o \
+	%D%/nano.specs \
+	%D%/nsim.specs
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 6b0117805570..ef7b57854bd8 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -52,8 +52,7 @@ case "${target}" in
 	config_testsuite=true
 	;;
   arc*-*-*)
-	AC_CONFIG_FILES([arc/Makefile])
-	subdirs="$subdirs arc"
+	config_arc=true
 	;;
   csky*-*-*)
 	AC_CONFIG_FILES([csky/Makefile])
@@ -251,7 +250,7 @@ AC_SUBST(subdirs)
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
-  aarch64 arm bfin iq2000 libnosys lm32 riscv wince
+  aarch64 arc arm bfin iq2000 libnosys lm32 riscv wince
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] libgloss: merge d30v into top-level Makefile
  2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
                   ` (2 preceding siblings ...)
  2022-12-21  1:58 ` [PATCH 3/4] libgloss: merge arc " Mike Frysinger
@ 2022-12-21  1:58 ` Mike Frysinger
  2023-01-09 10:51 ` [PATCH 0/4] libgloss: convert a few more arches to automake Corinna Vinschen
  4 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2022-12-21  1:58 UTC (permalink / raw)
  To: newlib

Avoid a recursive make to speed things up a bit.
---
 libgloss/Makefile.am       |   3 +
 libgloss/Makefile.in       | 112 +++++++++++++++++++++++---------
 libgloss/configure         |  19 ++++--
 libgloss/configure.ac      |   5 +-
 libgloss/d30v/Makefile.in  | 129 -------------------------------------
 libgloss/d30v/Makefile.inc |  12 ++++
 6 files changed, 112 insertions(+), 168 deletions(-)
 delete mode 100644 libgloss/d30v/Makefile.in
 create mode 100644 libgloss/d30v/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index f5016dcd4b3e..9d047b255582 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -72,6 +72,9 @@ endif
 if CONFIG_BFIN
 include bfin/Makefile.inc
 endif
+if CONFIG_D30V
+include d30v/Makefile.inc
+endif
 if CONFIG_IQ2000
 include iq2000/Makefile.inc
 endif
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index ef7b57854bd8..59230edc9917 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -141,8 +141,7 @@ case "${target}" in
 	subdirs="$subdirs crx"
 	;;
   d30v-*-*)
-	AC_CONFIG_FILES([d30v/Makefile])
-	subdirs="$subdirs d30v"
+	config_d30v=true
 	;;
   fr30-*-*)
 	AC_CONFIG_FILES([fr30/Makefile])
@@ -250,7 +249,7 @@ AC_SUBST(subdirs)
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
-  aarch64 arc arm bfin iq2000 libnosys lm32 riscv wince
+  aarch64 arc arm bfin d30v iq2000 libnosys lm32 riscv wince
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
diff --git a/libgloss/d30v/Makefile.in b/libgloss/d30v/Makefile.in
deleted file mode 100644
index a27e720ff8bb..000000000000
--- a/libgloss/d30v/Makefile.in
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright (c) 1997 Cygnus Support
-#
-# The authors hereby grant permission to use, copy, modify, distribute,
-# and license this software and its documentation for any purpose, provided
-# that existing copyright notices are retained in all copies and that this
-# notice is included verbatim in any distributions. No written agreement,
-# license, or royalty fee is required for any of the authorized uses.
-# Modifications to this software may be copyrighted by their authors
-# and need not follow the licensing terms described here, provided that
-# the new terms are clearly indicated on the first page of each file where
-# they apply.
-#
-
-#
-# This currently works with the D30V simulator.
-#
-
-DESTDIR =
-VPATH = @srcdir@ @srcdir@/..
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SHELL =	/bin/sh
-
-mkinstalldirs = $(SHELL) $(srcroot)/mkinstalldirs
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-
-OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
-	then echo ${objroot}/../binutils/objdump ; \
-	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
-OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
-	then echo ${objroot}/../binutils/objcopy ; \
-	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-
-OBJS		= isatty.o print.o putnum.o sbrk.o
-CFLAGS		= -g
-SCRIPTS		= ${SIM_SCRIPTS}
-
-# Here is all of the simulator stuff
-SIM_SCRIPTS	=
-SIM_LDFLAGS	=
-SIM_BSP		= libsim.a
-SIM_CRT0	= crt0.o
-SIM_OBJS	= syscalls.o outbyte.o inbyte.o
-SIM_TEST	=
-SIM_INSTALL	= install-sim
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-#
-# build a test program for each target board. Just trying to get
-# it to link is a good test, so we ignore all the errors for now.
-#
-all: 	${SIM_CRT0} ${SIM_BSP}
-
-#
-# here's where we build the board support packages for each target
-#
-
-${SIM_BSP}: ${OBJS} ${SIM_OBJS}
-	${AR} ${ARFLAGS} $@ ${SIM_OBJS} ${OBJS}
-	${RANLIB} $@
-
-#
-# here's where we build the test programs for each target
-#
-.PHONY: test
-test:	${SIM_TEST}
-
-crt0.o: crt0.S
-syscalls.o: syscalls.c $(srcdir)/../syscall.h
-outbyte.o: outbyte.c
-inbyte.o: inbyte.c
-
-isatty.o: $(srcdir)/../isatty.c
-print.o: $(srcdir)/../print.c
-putnum.o: $(srcdir)/../putnum.c
-sbrk.o: $(srcdir)/../sbrk.c
-
-clean mostlyclean:
-	rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile *~
-
-.PHONY: install info install-info clean-info
-install: ${SIM_INSTALL}
-
-install-sim:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x; done
-
-doc:
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/d30v/Makefile.inc b/libgloss/d30v/Makefile.inc
new file mode 100644
index 000000000000..2b12739d749f
--- /dev/null
+++ b/libgloss/d30v/Makefile.inc
@@ -0,0 +1,12 @@
+multilibtool_LIBRARIES += %D%/libsim.a
+%C%_libsim_a_SOURCES = \
+	isatty.c \
+	print.c \
+	putnum.c \
+	sbrk.c \
+	%D%/inbyte.c \
+	%D%/outbyte.c \
+	%D%/syscalls.c
+
+multilibtool_DATA += \
+	%D%/crt0.o
-- 
2.38.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] libgloss: convert a few more arches to automake
  2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
                   ` (3 preceding siblings ...)
  2022-12-21  1:58 ` [PATCH 4/4] libgloss: merge d30v " Mike Frysinger
@ 2023-01-09 10:51 ` Corinna Vinschen
  4 siblings, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2023-01-09 10:51 UTC (permalink / raw)
  To: newlib

On Dec 20 20:58, Mike Frysinger wrote:
> This speeds the build up and simplifies the source rules.  It also
> gets us to ~20% arch conversion (9/49), so hopefully it will make
> it easier for new ports to use (more examples), and encourage some
> existing ones to convert.
> 
> Mostly I wanted to burn down aarch64 & arm, but I did arc & d30v
> too since they were small & easy.
> 
> Verified that `make install` produces the same set of files with
> the same contents (at the disassembly level).
> 
> Mike Frysinger (4):
>   libgloss: merge aarch64 into top-level Makefile
>   libgloss: merge arm into top-level Makefile
>   libgloss: merge arc into top-level Makefile
>   libgloss: merge d30v into top-level Makefile

LGTM.


Thanks,
Corinna


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-09 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-21  1:58 [PATCH 0/4] libgloss: convert a few more arches to automake Mike Frysinger
2022-12-21  1:58 ` [PATCH 1/4] libgloss: merge aarch64 into top-level Makefile Mike Frysinger
2022-12-21  1:58 ` [PATCH 2/4] libgloss: merge arm " Mike Frysinger
2022-12-21  1:58 ` [PATCH 3/4] libgloss: merge arc " Mike Frysinger
2022-12-21  1:58 ` [PATCH 4/4] libgloss: merge d30v " Mike Frysinger
2023-01-09 10:51 ` [PATCH 0/4] libgloss: convert a few more arches to automake Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).