[PATCH] libgloss: merge csky 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 csky-elf build shows installed objects & libs produce same code.
---
 libgloss/Makefile.am       |   3 +
 libgloss/Makefile.in       | 499 +++++++++++++++++++++++++++++++++----
 libgloss/configure         |  19 +-
 libgloss/configure.ac      |   5 +-
 libgloss/csky/Makefile.in  | 125 ----------
 libgloss/csky/Makefile.inc |  36 +++
 6 files changed, 506 insertions(+), 181 deletions(-)
 delete mode 100644 libgloss/csky/Makefile.in
 create mode 100644 libgloss/csky/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index daff91fdfc51..4309cd3a4b05 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -75,6 +75,9 @@ endif
 if CONFIG_BFIN
 include bfin/Makefile.inc
 endif
+if CONFIG_CSKY
+include csky/Makefile.inc
+endif
 if CONFIG_D30V
 include d30v/Makefile.inc
 endif
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index d636cf6d2aaf..5fb26845c2eb 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -55,8 +55,7 @@ case "${target}" in
 	config_arc=true
 	;;
   csky*-*-*)
-	AC_CONFIG_FILES([csky/Makefile])
-	subdirs="$subdirs csky"
+	config_csky=true
 	;;
   epiphany-*-*)
 	AC_CONFIG_FILES([epiphany/Makefile])
@@ -248,7 +247,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 d30v iq2000 libnosys lm32 nios2 riscv wince
+  aarch64 arc arm bfin csky d30v iq2000 libnosys lm32 nios2 riscv wince
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
diff --git a/libgloss/csky/Makefile.in b/libgloss/csky/Makefile.in
deleted file mode 100644
index ebf7ef2cd47e..000000000000
--- a/libgloss/csky/Makefile.in
+++ /dev/null
@@ -1,125 +0,0 @@
-# Copyright (c) 1995, 1996, 2001 Cygnus Support  -*- mode:makefile -*-
-#
-# 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.
-#
-# csky semihosting support.
-#
-
-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@
-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@
-AR_FLAGS = qv
-
-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=crt0.S
-
-#
-# here's all the hosted stuff
-#
-HOSTED_BSP=	libsemi.a
-HOSTED_SRS=     io-semi.S
-HOSTED_SRC=     sbrk.c io-gdb.c io-exit.c io-close.c io-fstat.c io-gettimeofday.c \
-                io-lseek.c io-read.c io-system.c io-unlink.c io-exit.c \
-                io-gdb.c io-isatty.c io-open.c io-rename.c io-stat.c \
-                io-time.c io-write.c kill.o getpid.o
-HOSTED_OBJS=	$(patsubst %.c,%.o,$(HOSTED_SRC))
-
-INCLUDES+= -I/home/xialf/workspace/newlib-2.5.0.20171222/newlib/libc/include
-
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
-
-all :: $(HOSTED_BSP)
-
-#
-# here's where we build the board support packages for each target
-#
-
-# build hosted library
-$(HOSTED_OBJS) : %.o : %.c
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -nostdlib -DHOSTED=1 $(INCLUDES) -c $< -o $@
-$(HOSTED_SRS:%.S=%.o): %.o : %.S
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -nostdlib -DHOSTED=1 $(INCLUDES) -c $< -o $@
-
-$(HOSTED_BSP): $(HOSTED_OBJS)  $(HOSTED_SRS:%.S=%.o)
-	${AR} ${ARFLAGS} $@ $^
-	${RANLIB} $@
-
-crt0.o: $(CRT0)
-	$(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -c $< -o $@
-
-.PHONY: install info dvi doc install-info clean-info
-install:: install_hosted crt0.o
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	$(INSTALL_PROGRAM) crt0.o $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(crt0.o)
-
-.PHONY:install_hosted
-install_hosted::
-	${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}
-	$(INSTALL_PROGRAM) $(HOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(HOSTED_BSP)
-
-# target specific makefile fragment comes in here.
-@target_makefile_frag@
-
-clean mostlyclean:
-	rm -f a.out core *.i *~ *.a *.o *-test *.srec *.dis *.x *.map
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile
-
-info dvi doc:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/csky/Makefile.inc b/libgloss/csky/Makefile.inc
new file mode 100644
index 000000000000..7f38d659cbcd
--- /dev/null
+++ b/libgloss/csky/Makefile.inc
@@ -0,0 +1,36 @@
+## csky semihosting support.
+
+multilibtool_DATA += \
+	%D%/crt0.o
+libobjs_a_SOURCES += \
+	%D%/crt0.S
+
+## Here's all the hosted stuff.
+
+multilibtool_LIBRARIES += %D%/libsemi.a
+%C%_libsemi_a_SOURCES = \
+	%D%/io-semi.S \
+	%D%/sbrk.c \
+	%D%/io-gdb.c \
+	%D%/io-exit.c \
+	%D%/io-close.c \
+	%D%/io-fstat.c \
+	%D%/io-gettimeofday.c \
+	%D%/io-lseek.c \
+	%D%/io-read.c \
+	%D%/io-system.c \
+	%D%/io-unlink.c \
+	%D%/io-exit.c \
+	%D%/io-gdb.c \
+	%D%/io-isatty.c \
+	%D%/io-open.c \
+	%D%/io-rename.c \
+	%D%/io-stat.c \
+	%D%/io-time.c \
+	%D%/io-write.c \
+	%D%/kill.c \
+	%D%/getpid.c
+%C%_libsemi_a_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	-nostdlib \
+	-DHOSTED=1
-- 
2.39.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.