[PATCH] libgloss: merge or1k into top-level Makefile

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Avoid a recursive make to speed things up a bit.
A or1k-elf build shows installed objects & libs produce same code.
---
 libgloss/Makefile.am        |   3 +
 libgloss/Makefile.in        | 448 ++++++++++++++++++++++++++++--------
 libgloss/configure          |  19 +-
 libgloss/configure.ac       |   5 +-
 libgloss/or1k/Makefile.in   | 145 ------------
 libgloss/or1k/Makefile.inc  |  66 ++++++
 libgloss/or1k/boards/README |   5 +-
 7 files changed, 436 insertions(+), 255 deletions(-)
 delete mode 100644 libgloss/or1k/Makefile.in
 create mode 100644 libgloss/or1k/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 00a637a13831..e685be708abe 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -126,6 +126,9 @@ endif
 if CONFIG_NIOS2
 include nios2/Makefile.inc
 endif
+if CONFIG_OR1K
+include or1k/Makefile.inc
+endif
 if CONFIG_RISCV
 include riscv/Makefile.inc
 endif
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index 8856e9c0ff11..165e56b48237 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -215,8 +215,7 @@ case "${target}" in
 	config_iq2000=true
 	;;
   or1k-*-* | or1knd-*-* )
-	AC_CONFIG_FILES([or1k/Makefile])
-	subdirs="$subdirs or1k"
+	config_or1k=true
 	;;
   pru-*-*)
 	AC_CONFIG_FILES([pru/Makefile])
@@ -233,7 +232,7 @@ dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
   aarch64 arc arm bfin csky d30v epiphany frv i386 i960 iq2000 libnosys lm32
   m32r mcore mn10200 mn10300 moxie msp430
-  nds32 nios2 riscv rl78 rx v850 visium wince xstormy16 xtensa
+  nds32 nios2 or1k riscv rl78 rx v850 visium wince xstormy16 xtensa
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
diff --git a/libgloss/or1k/Makefile.in b/libgloss/or1k/Makefile.in
deleted file mode 100644
index c75d6e454633..000000000000
--- a/libgloss/or1k/Makefile.in
+++ /dev/null
@@ -1,145 +0,0 @@
-# Copyright (c) 1998 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.
-
-DESTDIR =
-VPATH = @srcdir@
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-program_transform_name = @program_transform_name@
-
-bindir = @bindir@
-libdir = @libdir@
-includedir = @includedir@
-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`
-
-# object files needed
-COMMON_FILES = syscalls \
-	or1k_uart \
-	outbyte \
-	caches-asm \
-	exceptions \
-	exceptions-asm \
-	interrupts \
-	interrupts-asm \
-	mmu-asm \
-	timer \
-	sbrk \
-	impure \
-	util \
-	sync-asm
-
-LIBOR1K_FILES = $(COMMON_FILES)
-LIBOR1K_OBJS = $(addsuffix .o,$(LIBOR1K_FILES))
-
-BOARDS = atlys \
-	de0_nano \
-	ml501 \
-	optimsoc \
-	or1ksim \
-	or1ksim-uart \
-	ordb1a3pe1500 \
-	ordb2a \
-	orpsocrefdesign
-
-BOARD_LIBS = $(addprefix libboard-,$(addsuffix .a,$(BOARDS)))
-BOARD_OBJS = $(addprefix libboard-,$(addsuffix .o,$(BOARDS)))
-
-GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
-	then echo -L${objroot}/../gcc ; fi`
-
-OUTPUTS = libor1k.a crt0.o ${BOARD_LIBS}
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-
-all: ${OUTPUTS}
-
-#
-# here's where we build the library for each target
-#
-
-libor1k.a: $(LIBOR1K_OBJS)
-	${AR} ${ARFLAGS} $@ $(LIBOR1K_OBJS)
-	${RANLIB} $@
-
-libboard-%.o: boards/%.S
-	${CC} ${CFLAGS} -o $@ -c $<
-
-libboard-%.o: boards/%.c
-	${CC} ${CFLAGS} -o $@ -c $<
-
-libboard-%.a: libboard-%.o
-	${AR} ${ARFLAGS} $@ $<
-	${RANLIB} $@
-
-doc:
-
-clean mostlyclean:
-	rm -f $(OUTPUTS) $(BOARD_LIBS) *.i *~ *.o *-test *.srec *.dis *.map *.x
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile config.status $(OUTPUTS)
-
-.PHONY: install info install-info clean-info
-install:
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR} $(DESTDIR)$(tooldir)/include
-	@for outputs in ${OUTPUTS}; do\
-	 $(INSTALL_DATA) $${outputs} $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}; \
-	done
-	$(INSTALL_DATA) ${srcdir}/include/or1k-support.h $(DESTDIR)$(tooldir)/include/
-	$(INSTALL_DATA) ${srcdir}/include/or1k-sprs.h $(DESTDIR)$(tooldir)/include/
-	$(INSTALL_DATA) ${srcdir}/include/or1k-asm.h $(DESTDIR)$(tooldir)/include/
-	$(INSTALL_DATA) ${srcdir}/include/or1k-nop.h $(DESTDIR)$(tooldir)/include/
-
-info:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/or1k/Makefile.inc b/libgloss/or1k/Makefile.inc
new file mode 100644
index 000000000000..ecb7a83df52f
--- /dev/null
+++ b/libgloss/or1k/Makefile.inc
@@ -0,0 +1,66 @@
+## Copyright (c) 1998 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.
+
+multilibtool_DATA += %D%/crt0.o
+libobjs_a_SOURCES += %D%/crt0.S
+
+includetool_DATA += \
+	%D%/include/or1k-asm.h \
+	%D%/include/or1k-nop.h \
+	%D%/include/or1k-sprs.h \
+	%D%/include/or1k-support.h
+
+multilibtool_LIBRARIES += %D%/libor1k.a
+%C%_libor1k_a_SOURCES = \
+	%D%/syscalls.c \
+	%D%/or1k_uart.c \
+	%D%/outbyte.c \
+	%D%/caches-asm.S \
+	%D%/exceptions.c \
+	%D%/exceptions-asm.S \
+	%D%/interrupts.c \
+	%D%/interrupts-asm.S \
+	%D%/mmu-asm.S \
+	%D%/timer.c \
+	%D%/sbrk.c \
+	%D%/impure.c \
+	%D%/util.c \
+	%D%/sync-asm.S
+
+## Now all the board definitions.
+
+multilibtool_LIBRARIES += %D%/libboard-atlys.a
+%C%_libboard_atlys_a_SOURCES = %D%/boards/atlys.S
+
+multilibtool_LIBRARIES += %D%/libboard-de0_nano.a
+%C%_libboard_de0_nano_a_SOURCES = %D%/boards/de0_nano.S
+
+multilibtool_LIBRARIES += %D%/libboard-ml501.a
+%C%_libboard_ml501_a_SOURCES = %D%/boards/ml501.S
+
+multilibtool_LIBRARIES += %D%/libboard-optimsoc.a
+%C%_libboard_optimsoc_a_SOURCES = %D%/boards/optimsoc.S
+
+multilibtool_LIBRARIES += %D%/libboard-or1ksim.a
+%C%_libboard_or1ksim_a_SOURCES = %D%/boards/or1ksim.S
+
+multilibtool_LIBRARIES += %D%/libboard-or1ksim-uart.a
+%C%_libboard_or1ksim_uart_a_SOURCES = %D%/boards/or1ksim-uart.S
+
+multilibtool_LIBRARIES += %D%/libboard-ordb1a3pe1500.a
+%C%_libboard_ordb1a3pe1500_a_SOURCES = %D%/boards/ordb1a3pe1500.S
+
+multilibtool_LIBRARIES += %D%/libboard-ordb2a.a
+%C%_libboard_ordb2a_a_SOURCES = %D%/boards/ordb2a.S
+
+multilibtool_LIBRARIES += %D%/libboard-orpsocrefdesign.a
+%C%_libboard_orpsocrefdesign_a_SOURCES = %D%/boards/orpsocrefdesign.S
diff --git a/libgloss/or1k/boards/README b/libgloss/or1k/boards/README
index b6c5abf92c52..290b798b5552 100644
--- a/libgloss/or1k/boards/README
+++ b/libgloss/or1k/boards/README
@@ -60,6 +60,5 @@ steps:
        implementation. It is recommended to do so in assembler board files to
        keep the ability to overwrite the default implementation by the user.
 
-When you are done with your board, add it to libgloss/or1k/Makefile.in to the
-BOARDS variable and compile.
-
+When you are done with your board, add it to libgloss/or1k/Makefile.inc like the
+other libboard-*.a definitions and compile.
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.